多租户Azure AD Auth Azure AD B2C使用自定义策略
问题描述:
我正尝试在Azure AD B2C中使用Azure AD Auth使用/ common Azure AD enpoint。据How to sign in any Azure Active Directory (AD) user using the multi-tenant application pattern,需要有一种机制,要么:多租户Azure AD Auth Azure AD B2C使用自定义策略
- 允许多个发行人,或
- 指定发行商B2C可以验证对列表。
我在自定义策略XML中看不到任何可能的设置,允许这样做。我能够在我的TrustFrameworkExtensions.xml文件中成功创建Azure AD认证,现在不是多租户。
答
为了支持多租户Azure AD,您需要使用不同的值在自定义策略中配置您的ClaimsProvider。
使用下面的值,确保使用client_id和IdTokenAudience进行替换。
<Item Key="DiscoverMetadataByTokenIssuer">true</Item>
<Item Key="ValidTokenIssuerPrefixes">https://sts.windows.net/</Item>
<Item Key="authorization_endpoint">https://login.microsoftonline.com/common/oauth2/authorize</Item>
<Item Key="client_id">df5b2515-a8d2-4d91-ab4f-eac6e1e416c2</Item>
<Item Key="BearerTokenTransmissionMethod">AuthorizationHeader</Item>
<Item Key="scope">openid</Item>
<Item Key="UsePolicyInRedirectUri">false</Item>
<Item Key="HttpBinding">POST</Item>
<Item Key="response_types">id_token</Item>
<Item Key="IdTokenAudience">df5b2515-a8d2-4d91-ab4f-eac6e1e416c2</Item>
注意:此功能是没有正式即使在预览还,所以请谨慎使用。继续监控以查看完整记录和支持的时间。