如何删除从asp.net identityserver3分页的注销和注销

vik*_*iti 1 asp.net single-sign-on identityserver3

我只想为我的应用程序和身份服务器3进行简单的单点登录,这被认为是一个很好的解决方案.通过同意页面,注销和退出页面,我不喜欢它的三件事.我设法通过将这些行设置为Clients.cs文件来禁用同意页面

RequireConsent = false,
AllowRememberConsent = false,
Run Code Online (Sandbox Code Playgroud)

我还在自定义视图服务上的文档后面添加了自定义视图.

那么现在如何禁用注销和注销页面,以便在用户单击注销按钮时自动将用户发送到主页?

Jam*_*tan 5

这里的文档将对您有所帮助.您有兴趣指定自定义集AuthenticationOptions.在其中,有三个感兴趣的属性:

  1. EnableSignOutPrompt

    指示IdentityServer是否将显示用于注销的确认页面.当客户端启动注销时,默认情况下IdentityServer将要求用户进行确认.这是一种针对"注销垃圾邮件"的缓解技术.默认为true.

  2. EnablePostSignOutAutoRedirect

    获取或设置一个值,该值指示IdentityServer是否自动重定向回传递给注销端点的经过验证的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"
            });
        });
    }
}
Run Code Online (Sandbox Code Playgroud)