我使用CustomViewService。
注销后,用户应重定向到登录页面。从logout页面自动重定向不是解决方案,因为CustomViewService的具体实现。
public Task<Stream> LoggedOut(LoggedOutViewModel model, SignOutMessage message)
{
return Render(model, "loggedOut");
}
This post can't solve my problem :(
我的身份服务器设置示例:
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);
});
}
答案 0 :(得分:2)
除了您链接到的SO帖子中提到的内容之外,您还必须将id_token
传递给post_logout_redirect才能正常工作。
请参阅https://identityserver.github.io/Documentation/docsv2/endpoints/endSession.html