2016-08-11 120 views
1

我只想爲我的應用程序和identityserver3進行簡單的單一登錄,看起來是一個很好的解決方案。有三件事我不喜歡,雖然是同意頁面,註銷和註銷頁面。我設法通過設置這些線路的Clients.cs文件如何從asp.net中刪除註銷和註銷頁面identityserver3

RequireConsent = false, 
AllowRememberConsent = false, 

我還添加了自定義視圖下的自定義視圖服務的文檔禁用同意頁面。

so now如何禁用註銷和註銷頁面,以便當用戶單擊註銷按鈕時自動將用戶發送到主頁?

回答

4

該文檔here將幫助你。您有興趣指定一套AuthenticationOptions的自定義設置。內,有感興趣的三個屬性:

  1. EnableSignOutPrompt

    表示IdentityServer是否顯示註銷確認頁面。當客戶端發起註銷時,IdentityServer默認會要求用戶確認。這是針對「註銷垃圾郵件」的緩解技術。默認爲true。

  2. EnablePostSignOutAutoRedirect

    獲取或設置一個值,它指示是否IdentityServer自動重定向回傳遞給signout端點的驗證post_logout_redirect_uri。默認爲false。

  3. PostSignOutAutoRedirectDelay

    獲取或重定向到post_logout_redirect_uri之前設置延遲(以秒計)。默認爲0。

使用這三個設置,你應該能夠調整IdentityServer3根據自己的喜好。

例如,您的Startup.cs可能看起來像這樣:

public class Startup 
{ 
    public void Configuration(IAppBuilder app) 
    { 
     app.Map("/identity", idsrvApp => 
     { 
      idsrvApp.UseIdentityServer(new IdentityServerOptions 
      { 
       AuthenticationOptions = new AuthenticationOptions() 
       { 
        EnableSignOutPrompt = false, 
        EnablePostSignOutAutoRedirect = true, 
        PostSignOutAutoRedirectDelay = 0 
       }, 
       EnableWelcomePage = false, 
       Factory = Factory.Get(), 
       SigningCertificate = Certificate.Get(), 
       SiteName = "Identity Server Example" 
      }); 
     }); 
    } 
}