Aspnet Boilerplate GetValidTwoFactorProvidersAsync返回一个空列表 [英] Aspnet Boilerplate GetValidTwoFactorProvidersAsync returns an empty list

查看:104
本文介绍了Aspnet Boilerplate GetValidTwoFactorProvidersAsync返回一个空列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Aspnet Boilerplate管理多租户系统.我目前正在尝试打开2因素身份验证,该身份验证已复制到样板中.我已经登录到主机并打开了2FA(因为我知道除非在主机中先将其打开,否则不能在Tenanats中打开它).完成此操作后,我现在可以看到在每个租户中打开2FA的设置(已完成).我的问题是,尽管确实向主机用户请求了所期望的代码,但从来没有租户用户.我将其范围缩小到以下问题.成功登录后,这称为:

I am using Aspnet Boilerplate to manage a multi-tenant system. I am currently attempting to turn on 2-factor authentication, which is baked into the boilerplate. I have logged into the host and turned on 2FA (because I understand that it can't be on in the tenanats unless it's on in the host first). Once I do this, I can now see the settings to turn 2FA on in each tenant (which I have done). My problem is that, while the host users are indeed asked for a code as expected, no tenant users ever are. I've narrowed it down to the following issue. Upon successful login, this is called:

var signInResult = await _signInManager.SignInOrTwoFactorAsync(loginResult, loginModel.RememberMe);

这总是返回RequiresTwoFactor == false.这样做的原因是,在此调用中,将进行以下调用:

This always returns RequiresTwoFactor == false. The reason for this is that, within this call, a call is made to:

GetValidTwoFactorProvidersAsync(TUser user)

依次调用.NET Core中的同名函数.此调用返回一个空列表,这意味着我没有注册TwoFactor Provider.这很奇怪,因为以主机身份登录时,我得到了提供程序,但是作为租户,它返回了空值.有什么我想念为什么会发生的事情.另外,首先在那些样板代码中的那些地方(电子邮件和SMS)首先注册了?

which in turn calls the function of the same name within .NET Core. This call returns an empty list, meaning that I have no TwoFactor Providers registered. Which is weird, because logging in as a host I get providers, but as a tenant it returns empty. Is there anything I'm missing why this might be happening. Also, where exactly in the boilerplate code are those (email and SMS) providers registered in the first place?

推荐答案

请参见但是,Aspnet Boilerplate中不包括两因素身份验证的实现.

But the implementation of two factor authentication is not included in Aspnet Boilerplate.

这是 AspNetZero 中的一项功能,请参见 https://aspnetzero.com/Documents/Development-Guide-Core#two-factor-login

It's a feature in AspNetZero, see https://aspnetzero.com/Documents/Development-Guide-Core#two-factor-login

这篇关于Aspnet Boilerplate GetValidTwoFactorProvidersAsync返回一个空列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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