feat(web): add Discord OAuth service and authorization endpoints
- DiscordOAuthOptions for client_id, secret, redirect_uri - DiscordAuthService exchanges code for token and fetches user profile - /auth/discord and /auth/discord/callback endpoints - CreateDiscordPrincipal for cookie auth claims - Telegram principal now includes Platform claim for forward compatibility Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
namespace GmRelay.Web;
|
||||
|
||||
public sealed class DiscordOAuthOptions
|
||||
{
|
||||
public required string ClientId { get; set; }
|
||||
public required string ClientSecret { get; set; }
|
||||
public required string RedirectUri { get; set; }
|
||||
public string[] Scopes { get; set; } = ["identify", "guilds"];
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ClientId))
|
||||
throw new InvalidOperationException("Discord:ClientId is required.");
|
||||
if (string.IsNullOrWhiteSpace(ClientSecret))
|
||||
throw new InvalidOperationException("Discord:ClientSecret is required.");
|
||||
if (string.IsNullOrWhiteSpace(RedirectUri))
|
||||
throw new InvalidOperationException("Discord:RedirectUri is required.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user