Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 41eb4daeb4 | |||
| c423f04b42 | |||
| 7fe5f7aef3 | |||
| a567fc7cd7 |
@@ -31,9 +31,8 @@ public static class Api
|
|||||||
|
|
||||||
options.ClientId = authOptions.ClientId;
|
options.ClientId = authOptions.ClientId;
|
||||||
options.ClientSecret = authOptions.ClientSecret;
|
options.ClientSecret = authOptions.ClientSecret;
|
||||||
options.SignedOutCallbackPath = "/signout-callback-oidc";
|
|
||||||
|
|
||||||
options.ResponseType = "code";
|
options.ResponseType = "code";
|
||||||
|
|
||||||
options.SaveTokens = true;
|
options.SaveTokens = true;
|
||||||
options.GetClaimsFromUserInfoEndpoint = true;
|
options.GetClaimsFromUserInfoEndpoint = true;
|
||||||
|
|
||||||
@@ -41,16 +40,10 @@ public static class Api
|
|||||||
options.Scope.Add("openid");
|
options.Scope.Add("openid");
|
||||||
options.Scope.Add("profile");
|
options.Scope.Add("profile");
|
||||||
options.Scope.Add("email");
|
options.Scope.Add("email");
|
||||||
|
|
||||||
options.CorrelationCookie.SecurePolicy = CookieSecurePolicy.Always;
|
|
||||||
options.CorrelationCookie.SameSite = SameSiteMode.None;
|
|
||||||
options.CorrelationCookie.HttpOnly = true;
|
|
||||||
|
|
||||||
options.NonceCookie.SecurePolicy = CookieSecurePolicy.Always;
|
|
||||||
options.NonceCookie.SameSite = SameSiteMode.None;
|
|
||||||
options.NonceCookie.HttpOnly = true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
services.AddCascadingAuthenticationState();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,14 +76,6 @@ public static class Api
|
|||||||
|
|
||||||
public static WebApplication AddSecurityEndpoints(this WebApplication app)
|
public static WebApplication AddSecurityEndpoints(this WebApplication app)
|
||||||
{
|
{
|
||||||
app.MapGet("/login", async (HttpContext context, string redirectUri = "/") =>
|
|
||||||
{
|
|
||||||
await context.ChallengeAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties
|
|
||||||
{
|
|
||||||
RedirectUri = redirectUri,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
app.MapGet("/logout", async (HttpContext context, IHttpClientFactory httpClientFactory, IOptions<LiteCharmsSettings> settings) =>
|
app.MapGet("/logout", async (HttpContext context, IHttpClientFactory httpClientFactory, IOptions<LiteCharmsSettings> settings) =>
|
||||||
{
|
{
|
||||||
await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
@@ -99,7 +84,7 @@ public static class Api
|
|||||||
|
|
||||||
await context.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties
|
await context.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties
|
||||||
{
|
{
|
||||||
RedirectUri = currentBaseUrl
|
RedirectUri = currentBaseUrl,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user