使用自定义SAML策略注册B2C应用-配置声明

时间:2020-02-19 11:00:54

标签: azure saml azure-ad-b2c idp

我在Azure b2c中为我们的SAML应用程序创建了一些自定义策略。 现在,我想编辑azure b2c发送到SAMLResponse中的应用程序的声明。

我在trustframwworkbase中添加了声明:

  <ClaimType Id="TESTFELDSTRING">
    <DisplayName>TESTFELDSTRING</DisplayName>
    <DataType>string</DataType>
    <DefaultPartnerClaimTypes>
      <Protocol Name="OpenIdConnect" PartnerClaimType="TESTFELDSTRING" />
      <Protocol Name="SAML2" PartnerClaimType="TESTFELDSTRING" />
    </DefaultPartnerClaimTypes>
    <UserHelpText>Your TESTFELDSTRING name.</UserHelpText>
    <UserInputType>TextBox</UserInputType>
  </ClaimType>

然后我更改了自定义策略,并在其中添加了一些新的输出声明:

    <OutputClaim ClaimTypeReferenceId="TESTFELDSTRING" />

但是我的SAML响应中仍然缺少该声明。

我有一个应用程序希望获得一些有关SAML声明的信息,但我看不到如何传输它。 在“普通Azure AD”上,我将能够配置每个应用程序的声明。因此,一个应用程序发送的声明比另一应用程序发送的请求要多。如何在azure b2c中执行此操作? 我试图通过以下方式将索赔添加到我的应用注册清单中:

"optionalClaims": {
    "saml2Token": [
        {
            "name": "TESTFELDSTRING",
            "source": null,
            "essential": false,
            "additionalProperties": []
        }
]

} 但这也不起作用。 我传送的属性是:

    <saml:AttributeStatement xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <saml:Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"
                        NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
                        FriendlyName="Display Name"
                        >
            <saml:AttributeValue xsi:type="xs:string">XXX</saml:AttributeValue>
        </saml:Attribute>
        <saml:Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname"
                        NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
                        FriendlyName="Given Name"
                        >
            <saml:AttributeValue xsi:type="xs:string">XXX</saml:AttributeValue>
        </saml:Attribute>
        <saml:Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname"
                        NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
                        FriendlyName="Surname"
                        >
            <saml:AttributeValue xsi:type="xs:string">XXX</saml:AttributeValue>
        </saml:Attribute>
        <saml:Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
                        NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
                        FriendlyName="Email Address"
                        >
            <saml:AttributeValue xsi:type="xs:string">XXX@XXX.XXX</saml:AttributeValue>
        </saml:Attribute>
        <saml:Attribute Name="objectId"
                        NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
                        FriendlyName="User's Object ID"
                        >
            <saml:AttributeValue xsi:type="xs:string">xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</saml:AttributeValue>
        </saml:Attribute>
    </saml:AttributeStatement>

有人建议吗?

1 个答案:

答案 0 :(得分:0)

您遵循了这个sample吗?

您是否已在技术资料中将新的声明添加为输出声明?

您是否还在<RelyingParty>部分中将新的声明添加为输出声明?