refactor(identity): change receiver of OauthUtils.ExpandScopes()

This commit is contained in:
sam 2024-05-22 17:19:45 +02:00
parent 00a54f4f8b
commit 8bd118ea67
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
4 changed files with 13 additions and 14 deletions

View file

@ -6,7 +6,10 @@ namespace Foxchat.Identity.Utils;
public static class OauthUtils
{
public static readonly string[] Scopes = ["identify", "chat_client"];
public const string ClientCredentials = "client_credentials";
public const string AuthorizationCode = "authorization_code";
public static readonly string[] Scopes = ["identify", "email", "guilds", "chat_client"];
private static readonly string[] ForbiddenSchemes = ["javascript", "file", "data", "mailto", "tel"];
private const string OobUri = "urn:ietf:wg:oauth:2.0:oob";
@ -25,11 +28,7 @@ public static class OauthUtils
}
}
public static string[] ExpandScopes(this Token token) => token.Scopes.Contains("chat_client")
public static string[] ExpandScopes(this string[] scopes) => scopes.Contains("chat_client")
? Scopes
: token.Scopes;
public static string[] ExpandScopes(this Application app) => app.Scopes.Contains("chat_client")
? Scopes
: app.Scopes;
: scopes;
}