首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Azure Active Directory B2C自定义验证

Azure Active Directory B2C自定义验证
EN

Stack Overflow用户
提问于 2017-08-24 00:49:15
回答 1查看 2.3K关注 0票数 1

如何在AAD B2C流程中执行用户的自定义验证?

也就是说,我们有一个具有各种属性的用户数据库我们想要使用B2C进行用户身份验证我们需要确保注册的用户正确匹配我们数据库中的现有用户,他们将获得访问的敏感信息,所以这在注册过程中非常重要,我们希望让用户填写他们的详细信息,但我们需要能够根据我们的数据库检查其中的一些详细信息,如果他们没有正确完成详细信息,则注册失败。例如匹配DoB、社会保险号、地址等。

这是实现我们所想的正确方法吗?https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-rest-api-validation-custom

如果验证失败,会发生什么?AAD帐户是否会被删除?如果放弃验证会发生什么?在B2C中有一个“首次登录”标志,如果验证失败和用户重试会发生什么,这个标志是如何设置的,以及由谁控制它?

EN

回答 1

Stack Overflow用户

发布于 2017-09-26 18:14:22

或者,您可以创建一个验证技术配置文件,它封装了由帐户注册技术配置文件执行的属性验证。

例如,您可能具有以下技术配置文件,该配置文件使用社会保险号注册本地帐户:

代码语言:javascript
复制
<TechnicalProfile Id="LocalAccount-Registration">
  <DisplayName>Local Account Registration</DisplayName>
  <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  <Metadata>
    <Item Key="ContentDefinitionReferenceId">api.localaccount.registration</Item>
    <Item Key="IpAddressClaimReferenceId">IpAddress</Item>
    <Item Key="language.button_continue">Create</Item>
  </Metadata>
  <CryptographicKeys>
    <Key Id="issuer_secret" StorageReferenceId="TokenSigningKeyContainer" />
  </CryptographicKeys>
  <InputClaims>
    <InputClaim ClaimTypeReferenceId="email" />
  </InputClaims>
  <OutputClaims>
    <OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="Verified.Email" Required="true" />
    <OutputClaim ClaimTypeReferenceId="newPassword" Required="true" />
    <OutputClaim ClaimTypeReferenceId="reenterPassword" Required="true" />
    <OutputClaim ClaimTypeReferenceId="displayName" Required="true" />
    <OutputClaim ClaimTypeReferenceId="extension_SocialSecurityNumber" Required="true" />
    <OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="localAccountAuthentication" />
    <OutputClaim ClaimTypeReferenceId="executed-SelfAsserted-Input" DefaultValue="true" />
    <OutputClaim ClaimTypeReferenceId="newUser" />
    <OutputClaim ClaimTypeReferenceId="objectId" />
    <OutputClaim ClaimTypeReferenceId="sub" />
    <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
  </OutputClaims>
  <ValidationTechnicalProfiles>
    <ValidationTechnicalProfile ReferenceId="AzureFunctions-CheckCustomer" />
    <ValidationTechnicalProfile ReferenceId="AzureActiveDirectoryStore-WriteUserByEmail-ThrowIfExists" />
  </ValidationTechnicalProfiles>
  <UseTechnicalProfileForSessionManagement ReferenceId="SSOSession-AzureActiveDirectory" />
</TechnicalProfile>

名为"AzureFunctions-CheckCustomer“的第一个验证技术配置文件在最终用户提交注册表单时执行,它调用Azure函数(或其他外部服务)来验证注册字段。

代码语言:javascript
复制
<TechnicalProfile Id="AzureFunctions-CheckCustomer">
  <DisplayName>Check Customer Azure Function</DisplayName>
  <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  <Metadata>
    <Item Key="ServiceUrl">https://contoso.azurewebsites.net/api/CheckCustomer?code=...</Item>
    <Item Key="AuthenticationType">None</Item>
    <Item Key="SendClaimsIn">Body</Item>
  </Metadata>
  <InputClaims>
    <InputClaim ClaimTypeReferenceId="extension_SocialSecurityNumber" PartnerClaimType="socialSecurityNumber" />
  </InputClaims>
  <UseTechnicalProfileForSessionManagement ReferenceId="SSOSession-Noop" />
</TechnicalProfile>

如果Azure函数返回200OK,则名为"AzureActiveDirectoryStore-WriteUserByEmail-ThrowIfExists“的下一个验证技术配置文件将创建本地帐户,最终用户可以继续执行下一步。如果Azure函数返回409冲突并显示错误消息,则不会创建本地帐户,并且会向最终用户显示错误消息。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45845324

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档