问题
Examples I find for IdentityServer4 use MVC for login UI. When a OpenIdConnect implicit client hits the 'authorization_endpoint' (example 'http://localhost:5000/connect/authorize') it gets redirected to the AccountController Login action. How would you configure IdentityServer4 to use a different controller or UI for as the login page?
回答1:
Under the ConfigureServices method (in Startup) add in a SetupIdentityServer options method:
services.AddIdentityServer(*SetupIdentityServer*)
.AddSigningCredential(...)
.AddValidationKeys()
.AddConfigurationStore(builder => builder.UseSqlServer(""))
.AddOperationalStore(builder => builder.UseSqlServer(""))
.AddAspNetIdentity<ApplicationUser>();
...where SetupIdentityServer is the name of a method where you can set the login url:
private static void SetupIdentityServer(IdentityServerOptions identityServerOptions)
{
identityServerOptions.UserInteraction.LoginUrl = "/Controller/Action";
}
来源:https://stackoverflow.com/questions/42403288/how-to-configure-login-ui-for-identityserver4