Azure AD B2C - 使用自定义策略时,根据用户所属的目录将用户重定向到登录页面
Azure AD B2C - Redirect the user to the login page based on the directory it belongs when using custom Policy
我的应用程序包含来自 B2B 和 B2C 目录的用户。它使用为此目的使用自定义策略创建的 Azure B2C 登录。当前,它在 B2C 登录屏幕中显示 B2B 目录按钮。在我的应用程序中,我们可以识别用户属于 B2C 还是 B2B 目录。
我的要求是,如果用户被识别为 B2B 用户,那么它应该直接重定向到 B2B 登录屏幕,而不是 B2C 登录并单击 B2B 登录按钮。
有什么方法可以在我的应用程序中实现这一点?
您可以将 <Domain>
分配给您的 B2B <ClaimsProvider>
。然后,将其作为 domain_hint
传递,这会将用户直接带到该 IDP。
这就是 Facebook 的设置方式 in a starter pack,您可以在那里尝试并复制所需的元素。
<ClaimsProvider>
<!-- The following Domain element allows this profile to be used if the request comes with domain_hint
query string parameter, e.g. domain_hint=facebook.com -->
<Domain>facebook.com</Domain>
...
</ClaimsProvider>
我的应用程序包含来自 B2B 和 B2C 目录的用户。它使用为此目的使用自定义策略创建的 Azure B2C 登录。当前,它在 B2C 登录屏幕中显示 B2B 目录按钮。在我的应用程序中,我们可以识别用户属于 B2C 还是 B2B 目录。
我的要求是,如果用户被识别为 B2B 用户,那么它应该直接重定向到 B2B 登录屏幕,而不是 B2C 登录并单击 B2B 登录按钮。
有什么方法可以在我的应用程序中实现这一点?
您可以将 <Domain>
分配给您的 B2B <ClaimsProvider>
。然后,将其作为 domain_hint
传递,这会将用户直接带到该 IDP。
这就是 Facebook 的设置方式 in a starter pack,您可以在那里尝试并复制所需的元素。
<ClaimsProvider>
<!-- The following Domain element allows this profile to be used if the request comes with domain_hint
query string parameter, e.g. domain_hint=facebook.com -->
<Domain>facebook.com</Domain>
...
</ClaimsProvider>