2016-08-11 122 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" 
      }); 
     }); 
    } 
}