mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 18:59:50 +08:00
Add shared OAuth flows
This commit is contained in:
@@ -4,7 +4,87 @@ pub(super) fn classify_oauth_route(
|
||||
method: &http::Method,
|
||||
normalized_path: &str,
|
||||
) -> Option<ClassifiedRoute> {
|
||||
if method == http::Method::GET && normalized_path == "/api/admin/oauth/supported-types" {
|
||||
if method == http::Method::GET && normalized_path == "/api/oauth/providers" {
|
||||
Some(classified(
|
||||
"public_support",
|
||||
"oauth",
|
||||
"list_providers",
|
||||
"user:oauth",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::GET
|
||||
&& normalized_path.starts_with("/api/oauth/")
|
||||
&& normalized_path.ends_with("/authorize")
|
||||
{
|
||||
Some(classified(
|
||||
"public_support",
|
||||
"oauth",
|
||||
"authorize",
|
||||
"user:oauth",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::GET
|
||||
&& normalized_path.starts_with("/api/oauth/")
|
||||
&& normalized_path.ends_with("/callback")
|
||||
{
|
||||
Some(classified(
|
||||
"public_support",
|
||||
"oauth",
|
||||
"callback",
|
||||
"user:oauth",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::GET && normalized_path == "/api/user/oauth/bindable-providers"
|
||||
{
|
||||
Some(classified(
|
||||
"public_support",
|
||||
"oauth",
|
||||
"bindable_providers",
|
||||
"user:oauth",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::GET && normalized_path == "/api/user/oauth/links" {
|
||||
Some(classified(
|
||||
"public_support",
|
||||
"oauth",
|
||||
"links",
|
||||
"user:oauth",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::POST
|
||||
&& normalized_path.starts_with("/api/user/oauth/")
|
||||
&& normalized_path.ends_with("/bind-token")
|
||||
{
|
||||
Some(classified(
|
||||
"public_support",
|
||||
"oauth",
|
||||
"bind_token",
|
||||
"user:oauth",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::GET
|
||||
&& normalized_path.starts_with("/api/user/oauth/")
|
||||
&& normalized_path.ends_with("/bind")
|
||||
{
|
||||
Some(classified(
|
||||
"public_support",
|
||||
"oauth",
|
||||
"bind",
|
||||
"user:oauth",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::DELETE
|
||||
&& normalized_path.starts_with("/api/user/oauth/")
|
||||
&& !normalized_path.contains("/bind")
|
||||
{
|
||||
Some(classified(
|
||||
"public_support",
|
||||
"oauth",
|
||||
"unbind",
|
||||
"user:oauth",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::GET && normalized_path == "/api/admin/oauth/supported-types" {
|
||||
Some(classified(
|
||||
"admin_proxy",
|
||||
"oauth_manage",
|
||||
|
||||
Reference in New Issue
Block a user