fix: oauth

This commit is contained in:
2024-10-14 00:29:53 +07:00
parent b7150c7c43
commit 9c4e16bba1

View File

@@ -16,7 +16,7 @@ builder.Services.AddAuthentication(options =>
{ {
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.CallbackPath = "/signin-oidc";
options.Authority = "https://oauth.e1lama.ru/application/o/asp_net"; options.Authority = "https://oauth.e1lama.ru/application/o/asp_net";
options.ClientId = ""; options.ClientId = "";
@@ -29,7 +29,7 @@ builder.Services.AddAuthentication(options =>
options.Scope.Add("profile"); options.Scope.Add("profile");
options.Scope.Add("email"); options.Scope.Add("email");
options.GetClaimsFromUserInfoEndpoint = true; options.GetClaimsFromUserInfoEndpoint = false;
options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters
{ {
@@ -73,7 +73,7 @@ var summaries = new[]
app.MapGet("/me", (HttpContext ctx) => app.MapGet("/me", (HttpContext ctx) =>
{ {
return ctx.User.Claims.Select(x => (x.Type, x.Value)); return ctx.User.Claims.Select(x => $"{x.Type} {x.Value}");
}) })
.RequireAuthorization() .RequireAuthorization()
.WithOpenApi(); .WithOpenApi();