如何为 IdentityServer4 配置登录 UI?
How to Configure login UI for IdentityServer4?
我为 IdentityServer4 找到的示例使用 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 登录操作。您将如何配置 IdentityServer4 以使用不同的控制器或 UI 作为登录页面?
在 ConfigureServices 方法下(在 Startup 中)添加一个 SetupIdentityServer 选项方法:
services.AddIdentityServer(*SetupIdentityServer*)
.AddSigningCredential(...)
.AddValidationKeys()
.AddConfigurationStore(builder => builder.UseSqlServer(""))
.AddOperationalStore(builder => builder.UseSqlServer(""))
.AddAspNetIdentity<ApplicationUser>();
...其中 SetupIdentityServer 是您可以设置登录的方法的名称 url:
private static void SetupIdentityServer(IdentityServerOptions identityServerOptions)
{
identityServerOptions.UserInteraction.LoginUrl = "/Controller/Action";
}
我为 IdentityServer4 找到的示例使用 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 登录操作。您将如何配置 IdentityServer4 以使用不同的控制器或 UI 作为登录页面?
在 ConfigureServices 方法下(在 Startup 中)添加一个 SetupIdentityServer 选项方法:
services.AddIdentityServer(*SetupIdentityServer*)
.AddSigningCredential(...)
.AddValidationKeys()
.AddConfigurationStore(builder => builder.UseSqlServer(""))
.AddOperationalStore(builder => builder.UseSqlServer(""))
.AddAspNetIdentity<ApplicationUser>();
...其中 SetupIdentityServer 是您可以设置登录的方法的名称 url:
private static void SetupIdentityServer(IdentityServerOptions identityServerOptions)
{
identityServerOptions.UserInteraction.LoginUrl = "/Controller/Action";
}