christo
christo

Reputation: 701

How I can ignore LoggedOut page after logout?

I use CustomViewService.

User should be redirected to login page after logout. Automatic redirect from logout page is not solution because specific implementation of CustomViewService.

    public Task<Stream> LoggedOut(LoggedOutViewModel model, SignOutMessage message)
    {
        return Render(model, "loggedOut");
    }

This post can't solve my problem :(

Sample of my identity server settings:

    public void Configuration(IAppBuilder appBuilder)
    {
        appBuilder.UseRequestScopeContext();

        appBuilder.Map("/core", coreApp =>
        {                
            Log.Logger = new LoggerConfiguration()
                    .MinimumLevel.Debug()
                    .WriteTo.Trace()
                    .CreateLogger();

            var factory = new IdentityServerServiceFactory();

            factory
                .UseInMemoryClients(Clients.Get())
                .UseInMemoryScopes(Scopes.Get())
                .UseInMemoryUsers(Users.Get());

            factory.CorsPolicyService = new Registration<ICorsPolicyService>(new DefaultCorsPolicyService { AllowAll = true });
            factory.UserService = new Registration<IUserService>(new UserService(new ApplicationDbContext()));
            factory.ViewService = new Registration<IViewService, CustomViewService>();

            var options = new IdentityServerOptions
            {
                SiteName = "MySite",
                SigningCertificate = Certificate.Get(),
                Factory = factory,
                RequireSsl = false,
                CspOptions = new CspOptions()
                {
                    Enabled = false
                },
                AuthenticationOptions = new AuthenticationOptions()
                {
                    EnableSignOutPrompt = false,
                    EnablePostSignOutAutoRedirect = true,
                    PostSignOutAutoRedirectDelay = 0,                        
                    RequireSignOutPrompt = false,
                },

                EnableWelcomePage = false
            };

            coreApp.UseIdentityServer(options);
        });
    }

Upvotes: 0

Views: 162

Answers (1)

John Korsnes
John Korsnes

Reputation: 2275

In addition to what is mentioned in the SO post you link to, you'll have to pass the id_token for the post_logout_redirect to work.

See https://identityserver.github.io/Documentation/docsv2/endpoints/endSession.html

Upvotes: 2

Related Questions