【发布时间】:2018-09-15 02:28:46
【问题描述】:
我正在尝试使用 B2C 自定义策略将 B2C 配置为我的 SAML Idp。作为测试,我已将我们的本地 ADFS 环境设置为 SAML RP,这似乎是 B2C 登录页面正常工作所必需的(B2C SAML 不支持 Idp 发起的会话)。
我一直按照 https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-get-started-custom 和 https://github.com/Azure-Samples/active-directory-b2c-advanced-policies/blob/master/Walkthroughs/RP-SAML.md 的指南来设置我的 B2C 环境。
我只显示了最终用户收到的 B2C 登录页面,但是在我将帐户的凭据输入到 B2C 登录页面后,我会使用 SAML 令牌重定向回我的 RP,但是它未解析任何已配置的声明。 SAML 令牌显示以下错误:
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Responder" />
<samlp:StatusMessage>Id:410906d7-639d-4828-b28d-22f84dfa617b ; Message: Policy 'B2C_1A_signup_signin_saml' in tenant ' mytenant.onmicrosoft.com'' specifies the claim 'sub' for the SubjectNamingInfo, but the claim is either not present or is null.</samlp:StatusMessage>
<IsPolicySpecificError>true</IsPolicySpecificError>
</samlp:Status>
我的 SignUpOrSigninSaml.xml RP 配置如下:
<RelyingParty>
<DefaultUserJourney ReferenceId="SignUpOrSignInSaml"/>
<TechnicalProfile Id="PolicyProfile">
<DisplayName>PolicyProfile</DisplayName>
<Protocol Name="SAML2" />
<Metadata>
<Item Key="PartnerEntity">https://adfs-test.mycorporation.com.au/FederationMetadata/2007-06/FederationMetadata.xml</Item>
<Item Key="KeyEncryptionMethod">Rsa15</Item>
<Item Key="DataEncryptionMethod">Aes256</Item>
<Item Key="XmlSignatureAlgorithm">Sha256</Item>
</Metadata>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="displayName" />
<OutputClaim ClaimTypeReferenceId="givenName" />
<OutputClaim ClaimTypeReferenceId="surname" />
</OutputClaims>
<!-- The ClaimType in the SubjectNamingInfo element below is a reference to the name of the claim added to the claims bag used by the token minting process.
This name is determined in the following order. If no PartnerClaimType is specified on the output claim above, then the DefaultPartnerClaimType for the protocol specified in the claims schema if one exists is used, otherwise the ClaimTypeReferenceId in the output claim is used.
For the SubjectNamingInfo below we use the DefaultPartnerClaimType of http://schemas.microsoft.com/identity/claims/objectidentifier, since the output claim does not specify a PartnerClaimType. -->
<!-- <SubjectNamingInfo ClaimType="http://schemas.microsoft.com/identity/claims/objectidentifier" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" ExcludeAsClaim="true"/> -->
<SubjectNamingInfo ClaimType="sub" />
</TechnicalProfile>
</RelyingParty>
我为“SubjectNamingInfo”尝试了几种不同的配置,例如:
<SubjectNamingInfo ClaimType="http://schemas.microsoft.com/identity/claims/objectidentifier" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" ExcludeAsClaim="true"/>
<SubjectNamingInfo ClaimType="sub" />
<SubjectNamingInfo ClaimType="name" />
但它们都产生相同的错误。
我相信,一旦对 SubjectNamingInfo 问题进行排序,配置的 OutputClaims 就会显示出来。
有人知道我该如何解决这个问题,以便我能够在令牌中看到我的用户帐户的声明吗?
---编辑---
我试图添加“sub”作为输出声明,但是由于它没有在基本文件中定义,B2C 不允许它。或者,我尝试将主题命名信息更改为已定义为输出声明的声明
<SubjectNamingInfo ClaimType="givenName" />
但是我似乎仍然遇到同样的错误:
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Responder" />
<samlp:StatusMessage>Id:a3fe7ab0-4483-45b6-93f8-e75b539a3aea ; Message: The relying party technical profile of policy 'mytenant.onmicrosoft.com' in tenant 'B2C_1A_signup_signin_saml' specifies the claim type 'givenName' as the subject naming info claim, but the claim is not present or is null.</samlp:StatusMessage>
<IsPolicySpecificError>true</IsPolicySpecificError>
【问题讨论】:
-
您是否在作为此旅程的一部分执行的任何步骤中为主题声明设置值?
-
@nyoung 我已经尝试将主题声明设置为 givenName 知道它应该在用户旅程期间设置。收到同样的错误
标签: saml-2.0 azure-ad-b2c