如何根据特定条件从 Azure AD B2C 自定义策略自动重定向到 Auth0 IDP

问题描述 投票:0回答:1

我们已使用自定义策略将 Auth0 添加为 Azure AD B2C 中的 IDP。我们希望根据条件重定向到 Auth0,而不是用户按下 UI 上的按钮。

以下是 Azure AD B2C 自定义策略中的 UserJourney:

    <UserJourneys>
        <UserJourney Id="Internal" DefaultCpimIssuerTechnicalProfileReferenceId="JwtIssuer">
            <OrchestrationSteps>
                <OrchestrationStep Order="1" Type="ClaimsExchange">
                    <ClaimsExchanges>
                        <ClaimsExchange Id="pre-hrd" TechnicalProfileReferenceId="SelfAsserted-EmailOrUsernameCollect" />
                    </ClaimsExchanges>
                </OrchestrationStep>
                <OrchestrationStep Order="2" Type="ClaimsExchange">
                    <Preconditions>
                        <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
                            <Value>objectIdFromSession</Value>
                            <Action>SkipThisOrchestrationStep</Action>
                        </Precondition>
                    </Preconditions>
                    <ClaimsExchanges>
                        <ClaimsExchange Id="HRD" TechnicalProfileReferenceId="HRD_Api" />
                    </ClaimsExchanges>
                </OrchestrationStep>
                <OrchestrationStep Order="3" Type="ClaimsExchange">
                    <Preconditions>
                        <Precondition Type="ClaimsExist" ExecuteActionsIf="false">
                            <Value>objectIdFromSession</Value>
                            <Action>SkipThisOrchestrationStep</Action>
                        </Precondition>
                    </Preconditions>
                    <ClaimsExchanges>
                        <ClaimsExchange Id="SSO_HRD" TechnicalProfileReferenceId="HRD_Api_SSO" />
                    </ClaimsExchanges>
                </OrchestrationStep>
    
                <OrchestrationStep Order="4" Type="CombinedSignInAndSignUp" ContentDefinitionReferenceId="api.signuporsignin">
                    <Preconditions>
                        <Precondition Type="ClaimEquals" ExecuteActionsIf="false">
                            <Value>idp</Value>
                            <Value>none</Value>
                            <Action>SkipThisOrchestrationStep</Action>
                        </Precondition>
                <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
                <Value>connection</Value>
                <Value>B2CLocalUser</Value>
                <Action>SkipThisOrchestrationStep</Action>
            </Precondition>
                    </Preconditions>
                    <ClaimsProviderSelections>                              
                        <ClaimsProviderSelection TargetClaimsExchangeId="Auth0Login" />             
                    </ClaimsProviderSelections>                     
                </OrchestrationStep>
    
                <OrchestrationStep Order="5" Type="ClaimsExchange">
                    <Preconditions>
                        <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
                            <Value>connection</Value>
                            <Value>B2CLocalUser</Value>
                            <Action>SkipThisOrchestrationStep</Action>
                        </Precondition>                      
                    </Preconditions>
                    <ClaimsExchanges>                                        
                        <ClaimsExchange Id="Auth0Login" TechnicalProfileReferenceId="Auth0-OID" />           
                    </ClaimsExchanges>
                </OrchestrationStep>
    
             
                <OrchestrationStep Order="6" Type="ClaimsExchange">
                    <Preconditions>
                        <Precondition Type="ClaimEquals" ExecuteActionsIf="false">
                            <Value>idp</Value>
                            <Value>none</Value>
                            <Action>SkipThisOrchestrationStep</Action>
                        </Precondition>              
                    </Preconditions>
                    <ClaimsExchanges>
                        <ClaimsExchange Id="SignUpWithLogonEmailExchange" TechnicalProfileReferenceId="LocalAccountSignUpWithLogonEmail" />
                    </ClaimsExchanges>
                </OrchestrationStep>-->
    
                <OrchestrationStep Order="6" Type="ClaimsExchange">
                    <Preconditions>
                        <Precondition Type="ClaimEquals" ExecuteActionsIf="false">
                            <Value>idp</Value>
                            <Value>costcoaad</Value>
                            <Action>SkipThisOrchestrationStep</Action>
                        </Precondition>
                        <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
                            <Value>objectId</Value>
                            <Action>SkipThisOrchestrationStep</Action>
                        </Precondition>
                    </Preconditions>
                    <ClaimsExchanges>
                        <ClaimsExchange Id="HintedAzureADExchange" TechnicalProfileReferenceId="Client-AAD" />
                    </ClaimsExchanges>
                </OrchestrationStep>

* further steps
**
***
     <OrchestrationSteps>
</UserJourney>
</UserJourneys>

此旅程在 UI 上显示 Auth0 的按钮,如下所示,但我们希望当

 上的“
idp
”值为“
none
”且“
connection
”不是“
B2CLocalUser
”时重定向到 Auth0 step 4

我们不想显示按钮,而是自动重定向到 Auth0 IDP 登录。

我们怎样才能做到这一点?我尝试提出一些条件,但没有成功。

感谢任何帮助。

谢谢。

更新:我无需用户交互即可重定向到 Auth0。我将步骤 4 如下所示,它根据条件将我重定向到 Auth0。

<OrchestrationStep Order="4" Type="ClaimsExchange">
            <Preconditions>
                <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
                    <Value>connection</Value>
                    <Value>B2CLocalUser</Value>
                    <Action>SkipThisOrchestrationStep</Action>
                </Precondition> 
                <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
                    <Value>objectId</Value>
                    <Action>SkipThisOrchestrationStep</Action>
                </Precondition>
            </Preconditions>
            <ClaimsExchanges>
                <ClaimsExchange Id="Auth0-Login" TechnicalProfileReferenceId="Auth0-OID-INM" />
            </ClaimsExchanges>
        </OrchestrationStep>
azure-active-directory single-sign-on azure-ad-b2c auth0 azure-ad-b2c-custom-policy
1个回答
0
投票

我无需用户交互即可重定向到 Auth0。我将步骤 4 如下所示,它根据条件将我重定向到 Auth0。

<OrchestrationStep Order="4" Type="ClaimsExchange">
                    <Preconditions>
                        <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
                            <Value>connection</Value>
                            <Value>B2CLocalUser</Value>
                            <Action>SkipThisOrchestrationStep</Action>
                        </Precondition> 
                        <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
                            <Value>objectId</Value>
                            <Action>SkipThisOrchestrationStep</Action>
                        </Precondition>
                    </Preconditions>
                    <ClaimsExchanges>
                        <ClaimsExchange Id="Auth0-Login" TechnicalProfileReferenceId="Auth0-OID-INM" />
                    </ClaimsExchanges>
                </OrchestrationStep>
© www.soinside.com 2019 - 2024. All rights reserved.