[英]Azure AD B2C Custom Policy: REST technical profile validation doesn't work
我在 Azure AD B2C 上创建了一个自定义注册策略,目的是只允许 email 被列入白名单的用户能够注册到系统中。
为此,我使用 REST 技术配置文件配置了自定义策略。
关联的 web 服务接收想要注册的用户的 email,并验证该用户的 email 地址是否在已列入白名单的电子邮件列表中。 如果不是,我会返回以下格式的消息:
{
"userMessage": "Sorry, this email is not whitelisted",
"status": 409,
"version": "1.0.0"
}
如果 email 是白名单的一部分,我返回:
{
"emailValue": "myemail@email.com",
"isWhiteListed": true
}
这是我的用户旅程的样子(在 Signup.xml 文件中):
<UserJourneys>
<UserJourney Id="SignUp">
<OrchestrationSteps>
<OrchestrationStep Order="1" Type="ClaimsExchange">
<ClaimsExchanges>
<ClaimsExchange Id="SignUpWithLogonEmailExchange" TechnicalProfileReferenceId="LocalAccountSignUpWithLogonEmail" />
</ClaimsExchanges>
</OrchestrationStep>
<!-- This step reads any user attributes that we may not have received when in the token. -->
<OrchestrationStep Order="2" Type="ClaimsExchange">
<ClaimsExchanges>
<ClaimsExchange Id="AADUserReadWithObjectId" TechnicalProfileReferenceId="AAD-UserReadUsingObjectId" />
</ClaimsExchanges>
</OrchestrationStep>
<OrchestrationStep Order="3" Type="ClaimsExchange">
<ClaimsExchanges>
<ClaimsExchange Id="RESTEmailWhitelist" TechnicalProfileReferenceId="REST-EmailWhitelist" />
</ClaimsExchanges>
</OrchestrationStep>
<OrchestrationStep Order="4" Type="SendClaims" CpimIssuerTechnicalProfileReferenceId="JwtIssuer" />
</OrchestrationSteps>
<ClientDefinition ReferenceId="DefaultWeb" />
</UserJourney>
</UserJourneys>
问题是即使在 email 未列入白名单的情况下返回 409 错误后,它仍然在 Azure AD B2C 中成功创建。
如何防止用户的帐户被成功创建?
您可能两次运行“AAD-UserwriteUsingEmail”验证技术配置文件,一次在 REST 调用之前,一次在它之后。 在 LocalAccountSignUpWithLogonEmail 技术配置文件的基本文件中删除验证技术配置文件。 然后将验证技术配置文件(AAD-userWriteUsingEmail 和 REST API)放入您的扩展文件中,在 LocalAccountSignUpWithLogonEmail 技术配置文件中,以正确的顺序(REST 然后写入)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.