identityserver4 - 使用 AddIdentityExpressAdminUiConfiguration() 而不是 AddDefaultIdentity() 时如何指定 SignIn.RequireConfirmedAccount?

标签 identityserver4 openid-connect identityserver3

我正在使用 services.AddIdentityExpressAdminUiConfiguration()来自 IdentityExpress 包。如何指定 SignIn.RequireConfirmedAccount

通常这会在 services.AddDefaultIdentity() 中完成打电话,但自AddIdentityExpressAdminUiConfiguration()添加身份,如果我这样做,我最终会出现异常。

将以下内容添加到 ConfigureServices() 不起作用: services.Configure<SignInOptions>(x => x.RequireConfirmedAccount = true).因为UserManager.Options.SignIn.RequireConfirmedAccount总是假的。

最佳答案

我通过将以下内容添加到 Configure() 来完成此操作:

app.ApplicationServices.GetRequiredService<IOptions<IdentityOptions>>().Value.SignIn.RequireConfirmedAccount = true;

这也适用于设置密码强度属性等。

试图在内部设置 ConfigureServices()没用。我怀疑它被 AddIdentityExpressAdminUiConfiguration() 中的逻辑覆盖了

关于identityserver4 - 使用 AddIdentityExpressAdminUiConfiguration() 而不是 AddDefaultIdentity() 时如何指定 SignIn.RequireConfirmedAccount?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60158994/

相关文章:

c# - IdentityServer4作为外部提供商,如何避免注销提示?

c# - 身份服务器 : Login after account activation

cookies - 如何使用带有 OpenId Connect 的刷新 token 在 asp.net 核心中处理过期的访问 token

wcf - 如何在WCF和WIF中使用JWT token ?

identityserver3 - 如何在 asp.net core 2.0 web api 中使用 identityserver3 来验证来自 Identityserver3 服务器的 token

c# - Identity Server 4 v3.1.2 UserInteraction LoginUrl 不起作用

react-native - react-native-app-auth 中的 RedirectURL 是什么 - 我如何返回我的应用程序?

asp.net - IdentityServer4 快速入门问题

asp.net-core - 使用 .AddIdentityServerJwt() 时,.NET Core Razor Pages 应用程序的身份验证不适用于没有 "/Identity"路由的 View

oauth-2.0 - 您是否为 OAuth 2.0 请求生成后端或前端状态参数?