IdentityServer3 将注销重定向到自定义 URL
IdentityServer3 redirect Logout to the Custom URL
我在 google 和 Stack Overflow 中搜索,没有合适的答案可用。
我在客户端应用程序中使用 ReactJs + Redux,.Net WebAPI 用于联系数据库和其他逻辑实现,最后我使用 IdentityServer3 对用户进行身份验证。
一旦我点击注销,我就会触发以下 URL:https://localhost:123/core/connect/endsession
new Client
{
Enabled = true,
ClientName = "Super Star Application",
ClientId = "SS",
Flow = Flows.Implicit,
RequireConsent = false,
RequireSignOutPrompt =false,
RedirectUris = new List<string>
{
"http://localhost:111/callback"
},
PostLogoutRedirectUris = new List<string> {"https://www.google.com/"},
AllowedCorsOrigins = new List<string>
{
"http://localhost:111/"
},
AllowAccessToAllScopes=true
}
在 Startup.cs 我有以下代码
app.Map("/core", core =>
{
var idSvrFactory = Factory.Configure();
idSvrFactory.ConfigureUserService("AspId");
var options = new IdentityServerOptions
{
SiteName = "Super Star",
SigningCertificate = Certificate.Get(),
Factory = idSvrFactory,
ProtocolLogoutUrls = new System.Collections.Generic.List<string>()
{
"https://www.google.co.in"
},
AuthenticationOptions = new AuthenticationOptions
{
EnablePostSignOutAutoRedirect=true,
EnableSignOutPrompt = false,
PostSignOutAutoRedirectDelay = 1,
EnableLoginHint = true,
RememberLastUsername = true,
EnableAutoCallbackForFederatedSignout = true,
RequireSignOutPrompt = false
}
};
core.UseIdentityServer(options);
});
我不知道如何重定向到 http://www.google.com 而不是以下屏幕
请帮助我...
您需要调用结束会话端点,传递 id 令牌和 post 注销重定向 url 作为参数。
/connect/endsession?id_token_hint={id token}&post_logout_redirect_uri=http://www.google.com
其中 {id token} 是调用 /connect/authorize 端点时从身份服务器返回的 ID 令牌。
在此处查看文档 https://identityserver.github.io/Documentation/docsv2/endpoints/endSession.html
请注意,您必须发回 id 令牌才能使重定向生效,否则结束会话请求的验证将失败,并且不会发生重定向。
我在 google 和 Stack Overflow 中搜索,没有合适的答案可用。
我在客户端应用程序中使用 ReactJs + Redux,.Net WebAPI 用于联系数据库和其他逻辑实现,最后我使用 IdentityServer3 对用户进行身份验证。
一旦我点击注销,我就会触发以下 URL:https://localhost:123/core/connect/endsession
new Client
{
Enabled = true,
ClientName = "Super Star Application",
ClientId = "SS",
Flow = Flows.Implicit,
RequireConsent = false,
RequireSignOutPrompt =false,
RedirectUris = new List<string>
{
"http://localhost:111/callback"
},
PostLogoutRedirectUris = new List<string> {"https://www.google.com/"},
AllowedCorsOrigins = new List<string>
{
"http://localhost:111/"
},
AllowAccessToAllScopes=true
}
在 Startup.cs 我有以下代码
app.Map("/core", core =>
{
var idSvrFactory = Factory.Configure();
idSvrFactory.ConfigureUserService("AspId");
var options = new IdentityServerOptions
{
SiteName = "Super Star",
SigningCertificate = Certificate.Get(),
Factory = idSvrFactory,
ProtocolLogoutUrls = new System.Collections.Generic.List<string>()
{
"https://www.google.co.in"
},
AuthenticationOptions = new AuthenticationOptions
{
EnablePostSignOutAutoRedirect=true,
EnableSignOutPrompt = false,
PostSignOutAutoRedirectDelay = 1,
EnableLoginHint = true,
RememberLastUsername = true,
EnableAutoCallbackForFederatedSignout = true,
RequireSignOutPrompt = false
}
};
core.UseIdentityServer(options);
});
我不知道如何重定向到 http://www.google.com 而不是以下屏幕
请帮助我...
您需要调用结束会话端点,传递 id 令牌和 post 注销重定向 url 作为参数。
/connect/endsession?id_token_hint={id token}&post_logout_redirect_uri=http://www.google.com
其中 {id token} 是调用 /connect/authorize 端点时从身份服务器返回的 ID 令牌。
在此处查看文档 https://identityserver.github.io/Documentation/docsv2/endpoints/endSession.html
请注意,您必须发回 id 令牌才能使重定向生效,否则结束会话请求的验证将失败,并且不会发生重定向。