如何配置IdentityServer4的登录UI?

2024-04-21

我找到的 IdentityServer4 使用示例MVC https://github.com/IdentityServer/IdentityServer4.Quickstart.UI用于登录用户界面。当 OpenIdConnect 隐式客户端点击“authorization_endpoint”时(例如“http://localhost:5000/connect/authorize http://localhost:5000/connect/authorize')它被重定向到账户控制器 https://github.com/IdentityServer/IdentityServer4.Quickstart.UI/blob/release/Quickstart/Account/AccountController.cs登录操作。您将如何配置 IdentityServer4 以使用不同的控制器或 UI 作为登录页面?


在ConfigureServices方法下(在启动中)添加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";
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何配置IdentityServer4的登录UI? 的相关文章

随机推荐