Release v1.0.0 #16

Merged
Wesser merged 492 commits from release/v1.0.0 into master 2025-02-12 09:19:32 +03:00
286 changed files with 15112 additions and 99 deletions
Showing only changes of commit c4a4478b8c - Show all commits

View File

@ -83,7 +83,7 @@ public class AuthController(IOptionsSnapshot<Admin> user, IOptionsSnapshot<Gener
traceId,
true), "text/html");
var result = await oAuthService.LoginOAuth(HttpContext, GetCookieParams(),
var result = await oAuthService.LoginOAuth(GetCookieParams(), HttpContext,
HttpContext.GetApiUrl(Url.Action("OAuth2")!), code, state);
string? callbackUrl = null;
@ -136,7 +136,7 @@ public class AuthController(IOptionsSnapshot<Admin> user, IOptionsSnapshot<Gener
if (!callback.IsAbsoluteUri)
throw new ControllerArgumentException("The callback URL must be absolute.");
return Redirect(oAuthService.GetProviderRedirect(HttpContext, GetCookieParams(),
return Redirect(oAuthService.GetProviderRedirect(GetCookieParams(), HttpContext,
HttpContext.GetApiUrl(Url.Action("OAuth2")!),
(OAuthProvider)provider,
callback).AbsoluteUri);

View File

@ -175,7 +175,7 @@ public class OAuthService(ILogger<OAuthService> logger, Dictionary<OAuthProvider
cancellationToken: cancellation);
public Uri GetProviderRedirect(HttpContext context, CookieOptions cookieOptions, string redirectUri,
public Uri GetProviderRedirect(CookieOptions cookieOptions, HttpContext context, string redirectUri,
OAuthProvider provider, Uri callback)
{
var (clientId, _) = providers[provider];
@ -206,7 +206,7 @@ public class OAuthService(ILogger<OAuthService> logger, Dictionary<OAuthProvider
public (OAuthProvider Provider, Uri Redirect)[] GetAvailableProviders(string redirectUri) =>
[.. providers.Select(x => (x.Key, new Uri(redirectUri.TrimEnd('/') + "/?provider=" + (int)x.Key)))];
public async Task<LoginOAuth> LoginOAuth(HttpContext context, CookieOptions cookieOptions,
public async Task<LoginOAuth> LoginOAuth(CookieOptions cookieOptions, HttpContext context,
string redirectUrl, string code, string state, CancellationToken cancellation = default)
{
var result = new LoginOAuth()
@ -326,7 +326,8 @@ public class OAuthService(ILogger<OAuthService> logger, Dictionary<OAuthProvider
return result;
}
public async Task<(OAuthUser? User, string? Message, bool IsSuccess)> GetOAuthUser(HttpContext context, CookieOptions cookieOptions, string token, CancellationToken cancellation = default)
public async Task<(OAuthUser? User, string? Message, bool IsSuccess)>
GetOAuthUser(CookieOptions cookieOptions, HttpContext context, string token, CancellationToken cancellation = default)
{
var requestInfo = new RequestContextInfo(context, cookieOptions);