title: SAML 2.0 AttributeConsumingService from B2C Custom Policy
body: <p>I'm creating a SAML 2.0 Service Provider.
  The IDP i'm connecting to requires an AttributeConsumingService with the parameters listed below in the metadata:</p>
  <pre><code>&lt;AttributeConsumingService index=&quot;0&quot; isDefault=&quot;true&quot;&gt;
     &lt;ServiceName xml:lang=&quot;da&quot;&gt;MyServiceName&lt;/ServiceName&gt;
     &lt;RequestedAttribute Name=&quot;https://data.gov.dk/model/core/specVersion&quot; NameFormat=&quot;urn:oasis:names:tc:SAML:2.0:attrname-format:uri&quot; isRequired=&quot;true&quot; /&gt;
     &lt;RequestedAttribute Name=&quot;https://data.gov.dk/concept/core/nsis/loa&quot; NameFormat=&quot;urn:oasis:names:tc:SAML:2.0:attrname-format:uri&quot; isRequired=&quot;true&quot; /&gt;
     &lt;RequestedAttribute Name=&quot;https://data.gov.dk/model/core/eid/professional/cvr&quot; NameFormat=&quot;urn:oasis:names:tc:SAML:2.0:attrname-format:uri&quot; isRequired=&quot;true&quot; /&gt;
     &lt;RequestedAttribute Name=&quot;https://data.gov.dk/model/core/eid/professional/orgName&quot; NameFormat=&quot;urn:oasis:names:tc:SAML:2.0:attrname-format:uri&quot; isRequired=&quot;true&quot; /&gt;
  &lt;/AttributeConsumingService&gt;
  </code></pre>
  <p>With my current setup this is not returned in my b2c service provider metadata.</p>
  <p>How would i go about having my B2C custom policy creating this?</p>
  <p>My custom policy:</p>
  <pre><code>&lt;TechnicalProfile Id=&quot;NemLogin-SAML3&quot;&gt;
     &lt;DisplayName&gt;NemLogin3&lt;/DisplayName&gt;
     &lt;Description&gt;Login with your NemLogin3 account&lt;/Description&gt;
     &lt;Protocol Name=&quot;SAML2&quot; /&gt;
     &lt;Metadata&gt;
        &lt;Item Key=&quot;IssuerUri&quot;&gt;myIssuerId&lt;/Item&gt;
        &lt;Item Key=&quot;PartnerEntity&quot;&gt;https://www.nemlog-in.dk/media/zrrb0a1e/oio_saml_3_test-devtest4-idp-metadata-xml.txt&lt;/Item&gt;
        &lt;Item Key=&quot;NameIdPolicyFormat&quot;&gt;urn:oasis:names:tc:SAML:2.0:nameid-format:persistent&lt;/Item&gt;
        &lt;Item Key=&quot;ResponsesSigned&quot;&gt;false&lt;/Item&gt;
        &lt;Item Key=&quot;WantsEncryptedAssertions&quot;&gt;true&lt;/Item&gt;
     &lt;/Metadata&gt;
     &lt;CryptographicKeys&gt;
        &lt;Key Id=&quot;SamlMessageSigning&quot; StorageReferenceId=&quot;B2C_1A_Test&quot; /&gt;
        &lt;Key Id=&quot;SamlAssertionDecryption&quot; StorageReferenceId=&quot;B2C_1A_Test&quot; /&gt;
     &lt;/CryptographicKeys&gt;
     &lt;OutputClaims&gt;
        &lt;OutputClaim ClaimTypeReferenceId=&quot;issuerUserId&quot; PartnerClaimType=&quot;assertionSubjectName&quot; /&gt;
        &lt;OutputClaim ClaimTypeReferenceId=&quot;specVersion&quot; Required=&quot;true&quot; /&gt;
        &lt;OutputClaim ClaimTypeReferenceId=&quot;loa&quot; Required=&quot;true&quot; /&gt;
        &lt;OutputClaim ClaimTypeReferenceId=&quot;cvr&quot; Required=&quot;true&quot; /&gt;
        &lt;OutputClaim ClaimTypeReferenceId=&quot;orgName&quot; Required=&quot;true&quot; /&gt;
     &lt;/OutputClaims&gt;
     &lt;UseTechnicalProfileForSessionManagement ReferenceId=&quot;SM-Saml-idp&quot; /&gt;
  &lt;/TechnicalProfile&gt;
  </code></pre>
  <p>Definition of claims in my policy:</p>
  <pre><code>&lt;ClaimType Id=&quot;loa&quot;&gt;
     &lt;DisplayName&gt;Level of assurance&lt;/DisplayName&gt;
     &lt;DataType&gt;string&lt;/DataType&gt;
     &lt;DefaultPartnerClaimTypes&gt;
        &lt;Protocol Name=&quot;OpenIdConnect&quot; PartnerClaimType=&quot;loa&quot; /&gt;
        &lt;Protocol Name=&quot;SAML2&quot; PartnerClaimType=&quot;https://data.gov.dk/concept/core/nsis/loa&quot; /&gt;
     &lt;/DefaultPartnerClaimTypes&gt;
  &lt;/ClaimType&gt;
  
  &lt;ClaimType Id=&quot;cvr&quot;&gt;
     &lt;DisplayName&gt;Cvr&lt;/DisplayName&gt;
     &lt;DataType&gt;string&lt;/DataType&gt;
     &lt;DefaultPartnerClaimTypes&gt;
        &lt;Protocol Name=&quot;OpenIdConnect&quot; PartnerClaimType=&quot;cvr&quot; /&gt;
        &lt;Protocol Name=&quot;SAML2&quot; PartnerClaimType=&quot;https://data.gov.dk/model/core/eid/professional/cvr&quot; /&gt;
     &lt;/DefaultPartnerClaimTypes&gt;
  &lt;/ClaimType&gt;
  
  &lt;ClaimType Id=&quot;orgName&quot;&gt;
     &lt;DisplayName&gt;Organisation Name&lt;/DisplayName&gt;
     &lt;DataType&gt;string&lt;/DataType&gt;
     &lt;DefaultPartnerClaimTypes&gt;
        &lt;Protocol Name=&quot;OpenIdConnect&quot; PartnerClaimType=&quot;orgName&quot; /&gt;
        &lt;Protocol Name=&quot;SAML2&quot; PartnerClaimType=&quot;https://data.gov.dk/model/core/eid/professional/orgName&quot; /&gt;
     &lt;/DefaultPartnerClaimTypes&gt;
  &lt;/ClaimType&gt;
  
  &lt;ClaimType Id=&quot;specVersion&quot;&gt;
     &lt;DisplayName&gt;Spec Version&lt;/DisplayName&gt;
     &lt;DataType&gt;string&lt;/DataType&gt;
     &lt;DefaultPartnerClaimTypes&gt;
        &lt;Protocol Name=&quot;OpenIdConnect&quot; PartnerClaimType=&quot;specVersion&quot; /&gt;
        &lt;Protocol Name=&quot;SAML2&quot; PartnerClaimType=&quot;dk:gov:saml:attribute:SpecVer&quot; /&gt;
     &lt;/DefaultPartnerClaimTypes&gt;
  &lt;/ClaimType&gt;
  </code></pre>