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

how to remove logout and loggedout paged from asp.net identityserver3

我只想对我的应用程序和 identityserver3 进行简单的单点登录,这被认为是一个很好的解决方案。通过同意页面、注销和注销页面,我不喜欢它的三件事。我设法通过将这些行设置为 Clients.cs 文件

来禁用同意页面
RequireConsent = false,
AllowRememberConsent = false,

我还按照自定义视图服务上的文档添加了自定义视图。

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

文档 here 将为您提供帮助。您有兴趣指定 AuthenticationOptions 的自定义集。其中,有三个感兴趣的属性:

  1. EnableSignOutPrompt

    Indicates whether IdentityServer will show a confirmation page for sign-out. When a client initiates a sign-out, by default IdentityServer will ask the user for confirmation. This is a mitigation technique against “logout spam”. Defaults to true.

  2. EnablePostSignOutAutoRedirect

    Gets or sets a value indicating whether IdentityServer automatically redirects back to a validated post_logout_redirect_uri passed to the signout endpoint. Defaults to false.

  3. PostSignOutAutoRedirectDelay

    Gets or sets the delay (in seconds) before redirecting to a post_logout_redirect_uri. Defaults to 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"
            });
        });
    }
}