Azure B2C自定义重置密码策略 [英] Azure B2C Custom Reset Password Policy
本文介绍了Azure B2C自定义重置密码策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在B2C中有一些自定义策略在起作用,我不会尝试让重置密码起作用。我遇到的一个问题是,我调用RESTful API来检查提供的电子邮件地址是本地用户还是从Microsoft AAD登录的。这很好用,因此,如果用户是SSO用户,则通过Microsoft组织身份登录,如果不是,则通过B2C本地登录。
我的问题是,我正在尝试对重置密码执行类似的操作。我使用以下技术配置文件获取电子邮件地址
<TechnicalProfile Id="SelfAsserted-Signin-Email">
<DisplayName>Local Account Signin</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="DisplayName">Signin To Tax Systems</Item>
<Item Key="setting.operatingMode">Email</Item>
<Item Key="ContentDefinitionReferenceId">api.selfasserted</Item>
</Metadata>
<IncludeInSso>false</IncludeInSso>
<InputClaims>
<InputClaim ClaimTypeReferenceId="signInName" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="signInName" Required="true" />
</OutputClaims>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
</TechnicalProfile>
获取电子邮件地址后,我们调用REST API来检查电子邮件地址。该检查告诉我们该用户是联合用户还是本地用户。如果他们是联合用户,我想出错,因为他们无法通过B2C重置密码。
如果他们是本地用户,那么我们想要重置密码。这是通过以下技术配置文件完成的。问题是他们必须再次输入他们的电子邮件地址,我希望在电子邮件地址中预先填充以前获得的电子邮件地址。
<TechnicalProfile Id="LocalAccountDiscoveryUsingEmailAddress">
<DisplayName>Reset password using email address</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="IpAddressClaimReferenceId">IpAddress</Item>
<Item Key="ContentDefinitionReferenceId">api.localaccountpasswordreset</Item>
<Item Key="UserMessageIfClaimsTransformationBooleanValueIsNotEqual">Your account has been locked. Contact your support person to unlock it, then try again.</Item>
</Metadata>
<CryptographicKeys>
<Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" />
</CryptographicKeys>
<IncludeInSso>false</IncludeInSso>
<InputClaims>
<InputClaim ClaimTypeReferenceId="signInName" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="Verified.Email" Required="true" />
<OutputClaim ClaimTypeReferenceId="objectId" />
<OutputClaim ClaimTypeReferenceId="userPrincipalName" />
<OutputClaim ClaimTypeReferenceId="authenticationSource" />
</OutputClaims>
<ValidationTechnicalProfiles>
<ValidationTechnicalProfile ReferenceId="AAD-UserReadUsingEmailAddress" />
</ValidationTechnicalProfiles>
</TechnicalProfile>
你知道我该怎么做吗?关于元数据等,我似乎找不到有关api.localaccountpasswordreset
的详细信息。
推荐答案
您让它工作了吗?我对我的一个客户进行了类似的设置,并通过添加2个验证配置文件(https://docs.microsoft.com/en-us/azure/active-directory-b2c/validation-technical-profile)修复了此问题,并更改了输入声明:
- 在您的SelfAsserted-Sign-Email技术配置文件中调用REST API作为验证技术配置文件(https://docs.microsoft.com/en-us/azure/active-directory-b2c/restful-technical-profile)以检查电子邮件地址,如果电子邮件地址未联合,则在屏幕上显示错误;
- 调用引用ClaimsConvert的ClaimsConvert验证技术配置文件(https://docs.microsoft.com/en-us/azure/active-directory-b2c/claims-transformation-technical-profile)以将signInName复制到电子邮件(https://docs.microsoft.com/en-us/azure/active-directory-b2c/general-transformations#copyclaim);
- 将LocalAccount DiscoveryUsingEmailAddress技术配置文件中的输入声明更改为电子邮件。
这提供了一个干净的用户界面-如果用户是联合的,则第一个表单上会显示一个错误,并且第二个屏幕使用默认声明预先填充了电子邮件字段。
这篇关于Azure B2C自定义重置密码策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文