简体   繁体   English

Azure AD B2C,以编程方式获取MFA验证的电话号码

[英]Azure AD B2C, get MFA verified phone number programmatically

When I create a user in my web app using a B2C policy, and use a number for MFA, that number gets stored under "Authentication Contact Info" in the portal. 当我使用B2C策略在Web应用程序中创建用户并使用MFA号码时,该号码将存储在门户的“身份验证联系信息”下。 It does not get stored in the claim from what I can see. 据我所知,它没有存储在索赔中。

How can I access this number programmatically? 如何以编程方式访问此号码? If I wanted to access for example the users surname I'd use: 例如,如果要访问用户名,则使用:

var identity = (ClaimsPrincipal)Thread.CurrentPrincipal;
var name = identity.Claims.Where(c => c.Type == ClaimTypes.Surname).Select(c => c.Value).SingleOrDefault();

Is there any way, like above or any other way like for example using Graph API, to access the stored phone number used during MFA? 是否有任何方法(如上)或任何其他方法(例如,使用Graph API)访问MFA期间使用的存储电话号码?

As far as I know, it is not possible to retrieve the phone number for the MFA. 据我所知,无法检索MFA的电话号码。 We can only get the telephoneNumber(The primary telephone number of the user's place of business.) through the Azure AD Graph API( refer here ). 我们只能通过Azure AD Graph API(请参阅此处 )获得phoneNumber(用户营业地点的主要电话号码。)。

If you want the Azure AD Graph also support for the phone number(Authentication Contact Info) of for the MFA, you can submit the feedback from here . 如果希望Azure AD Graph还支持MFA的电话号码(身份验证联系信息),则可以从此处提交反馈。

It's possible to retrieve the phone number for the MFA through Microsoft's provisioning API published here . 可以通过此处发布的Microsoft的Provisioning API检索MFA的电话号码。

If you generate the code through svcutil.exe you will have to manually inject the soap authentication and version headers though. 如果通过svcutil.exe生成代码,则必须手动注入soap身份验证和版本标头。 You can then use the GetUser or ListUser service call to actually retrieve the phone number of a specific user from your Azure AD B2C. 然后,您可以使用GetUser或ListUser服务调用从Azure AD B2C实际检索特定用户的电话号码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM