Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3847927ace | |||
| d38d1dd059 | |||
| c27aba1954 | |||
| e646d16053 |
@@ -41,6 +41,25 @@ 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.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",
|
||||||
|
Port = -1,
|
||||||
|
};
|
||||||
|
|
||||||
|
context.ProtocolMessage.RedirectUri = uriBuilder.Uri.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
},
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
@@ -87,7 +106,7 @@ public static class Api
|
|||||||
{
|
{
|
||||||
await context.ChallengeAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties
|
await context.ChallengeAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties
|
||||||
{
|
{
|
||||||
RedirectUri = redirectUri,
|
RedirectUri = redirectUri,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -116,7 +135,7 @@ public static class Api
|
|||||||
|
|
||||||
await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
|
|
||||||
return Results.Redirect("/");
|
return Results.Redirect($"{authOptions.Authority}end-session/");
|
||||||
});
|
});
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
|
|||||||
Reference in New Issue
Block a user