This commit is contained in:
@@ -41,6 +41,24 @@ public static class Api
|
||||
options.Scope.Add("openid");
|
||||
options.Scope.Add("profile");
|
||||
options.Scope.Add("email");
|
||||
|
||||
options.Events = new OpenIdConnectEvents
|
||||
{
|
||||
OnRedirectToIdentityProvider = context =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(context.ProtocolMessage.RedirectUri) && context.ProtocolMessage.RedirectUri.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var uriBuilder = new UriBuilder(context.ProtocolMessage.RedirectUri)
|
||||
{
|
||||
Scheme = "https"
|
||||
};
|
||||
|
||||
context.ProtocolMessage.RedirectUri = uriBuilder.Uri.ToString();
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
return services;
|
||||
@@ -116,7 +134,7 @@ public static class Api
|
||||
|
||||
await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
|
||||
return Results.Redirect("/");
|
||||
return Results.Redirect($"{authOptions.Authority}end-session/");
|
||||
});
|
||||
|
||||
return app;
|
||||
|
||||
Reference in New Issue
Block a user