如何为IdentityServer4配置登录UI? [英] How to Configure login UI for IdentityServer4?

查看:654
本文介绍了如何为IdentityServer4配置登录UI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为IdentityServer4找到的示例将 MVC 用于登录UI。当OpenIdConnect隐式客户端命中 authorization_endpoint时(例如' http:// localhost:5000 / connect / authorize '),它将重定向到 AccountController 登录操作。您如何配置IdentityServer4以使用其他控制器或UI作为登录页面?

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?

推荐答案

在ConfigureServices方法下(在Startup中) )添加SetupIdentityServer选项方法:

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>();

...其中SetupIdentityServer是可以设置登录URL的方法的名称:

...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";
}

这篇关于如何为IdentityServer4配置登录UI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆