Add shared OAuth flows

This commit is contained in:
fawney19
2026-04-28 15:46:21 +08:00
parent 712b484bc8
commit 70f747d406
56 changed files with 5927 additions and 977 deletions
+81 -1
View File
@@ -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",