viktor miti viktor miti - 2 months ago 38
ASP.NET (C#) Question

how to remove logout and loggedout paged from identityserver3

I just want a simple single sign-on for my application and identityserver3 seen to be a good solution. three things i didn't like about it though the consent page, the logout and logged out pages. i manage to disable the consent page by setting these lines to the Clients.cs file

RequireConsent = false,
AllowRememberConsent = false,

i also added custom view following the docs on Custom View Service.

so now How do I disable the logout and loggedout pages so that it automatically send the user to the home page when they clicks the sign out button?


The documentation here will help you. You are interested in specifying a custom set of AuthenticationOptions. Within that, there are three properties of interest:

  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.

Using these three settings you should be able to tweak IdentityServer3 to your liking.

For example, your Startup.cs may look like this:

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"