[英]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而不是以下屏幕
請幫助我...
您需要調用 endsession 端點,傳遞 id 令牌和 post logout 重定向 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 令牌以使重定向工作,否則 endsession 請求的驗證將失敗並且不會發生重定向。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.