chore: add csharpier to husky, format backend with csharpier
This commit is contained in:
parent
5fab66444f
commit
7f971e8549
73 changed files with 2098 additions and 1048 deletions
|
@ -11,20 +11,30 @@ public class Application : BaseModel
|
|||
public required string[] Scopes { get; init; }
|
||||
public required string[] RedirectUris { get; init; }
|
||||
|
||||
public static Application Create(ISnowflakeGenerator snowflakeGenerator, string name, string[] scopes,
|
||||
string[] redirectUrls)
|
||||
public static Application Create(
|
||||
ISnowflakeGenerator snowflakeGenerator,
|
||||
string name,
|
||||
string[] scopes,
|
||||
string[] redirectUrls
|
||||
)
|
||||
{
|
||||
var clientId = RandomNumberGenerator.GetHexString(32, true);
|
||||
var clientSecret = AuthUtils.RandomToken();
|
||||
|
||||
if (scopes.Except(AuthUtils.ApplicationScopes).Any())
|
||||
{
|
||||
throw new ArgumentException("Invalid scopes passed to Application.Create", nameof(scopes));
|
||||
throw new ArgumentException(
|
||||
"Invalid scopes passed to Application.Create",
|
||||
nameof(scopes)
|
||||
);
|
||||
}
|
||||
|
||||
if (redirectUrls.Any(s => !AuthUtils.ValidateRedirectUri(s)))
|
||||
{
|
||||
throw new ArgumentException("Invalid redirect URLs passed to Application.Create", nameof(redirectUrls));
|
||||
throw new ArgumentException(
|
||||
"Invalid redirect URLs passed to Application.Create",
|
||||
nameof(redirectUrls)
|
||||
);
|
||||
}
|
||||
|
||||
return new Application
|
||||
|
@ -34,7 +44,7 @@ public class Application : BaseModel
|
|||
ClientSecret = clientSecret,
|
||||
Name = name,
|
||||
Scopes = scopes,
|
||||
RedirectUris = redirectUrls
|
||||
RedirectUris = redirectUrls,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue