Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using JSON in REST API with Azure AD B2C
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TrustFrameworkPolicy
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.microsoft.com/online/cpim/schemas/2013/06"
PolicySchemaVersion="0.3.0.0"
TenantId="yourtenant.onmicrosoft.com"
PolicyId="B2C_1A_Beeceptor_Test_xxx"
PublicPolicyUri="http://yourtenant.onmicrosoft.com/B2C_1A_Beeceptor_Test_xxx"
DeploymentMode="Development"
UserJourneyRecorderEndpoint="urn:journeyrecorder:applicationinsights"
>
<BasePolicy>
<TenantId>yourtenant.onmicrosoft.com</TenantId>
<PolicyId>B2C_1A_TRUSTFRAMEWORKBASEMFA</PolicyId>
</BasePolicy>
<BuildingBlocks>
<ClaimsSchema>
<ClaimType Id="id">
<DisplayName>ID</DisplayName>
<DataType>string</DataType>
</ClaimType>
<ClaimType Id="countryCode">
<DisplayName>result</DisplayName>
<DataType>string</DataType>
</ClaimType>
<ClaimType Id="mobileNumber">
<DisplayName>result</DisplayName>
<DataType>string</DataType>
</ClaimType>
<ClaimType Id="officeNumber">
<DisplayName>result</DisplayName>
<DataType>string</DataType>
</ClaimType>
<ClaimType Id="extension_dobirth">
<DisplayName>result</DisplayName>
<DataType>string</DataType>
</ClaimType>
<ClaimType Id="username">
<DisplayName>User name</DisplayName>
<DataType>string</DataType>
</ClaimType>
<ClaimType Id="requestBody">
<DisplayName>Request body</DisplayName>
<DataType>string</DataType>
</ClaimType>
</ClaimsSchema>
<ClaimsTransformations>
<ClaimsTransformation Id="GenerateIdentityRequestBody" TransformationMethod="GenerateJson">
<!-- <InputClaims> -->
<!-- <InputClaim ClaimTypeReferenceId="id" TransformationClaimType="inputClaim"/> -->
<!-- </InputClaims> -->
<InputParameters>
<InputParameter Id="id" DataType="string" Value="12345678"/>
<InputParameter Id="group.role" DataType="string" Value="Admin"/>
<InputParameter Id="group.branch" DataType="string" Value="Main"/>
</InputParameters>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="requestBody" TransformationClaimType="outputClaim"/>
</OutputClaims>
</ClaimsTransformation>
</ClaimsTransformations>
</BuildingBlocks>
<ClaimsProviders>
<ClaimsProvider>
<DisplayName>REST APIs</DisplayName>
<TechnicalProfiles>
<TechnicalProfile Id="REST-Identity-API">
<DisplayName>Test Customer Identity API</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<Metadata>
<Item Key="ServiceUrl">https://xxx.free.beeceptor.com/yyy</Item>
<Item Key="SendClaimsIn">Body</Item>
<Item Key="AuthenticationType">None</Item>
<Item Key="AllowInsecureAuthInProduction">false</Item>
<Item Key="ResolveJsonPathsInJsonTokens">true</Item>
<Item Key="ClaimUsedForRequestPayload">requestBody</Item>
</Metadata>
<InputClaimsTransformations>
<InputClaimsTransformation ReferenceId="GenerateIdentityRequestBody"/>
</InputClaimsTransformations>
<InputClaims>
<InputClaim ClaimTypeReferenceId="requestBody"/>
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="id"/>
<OutputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="firstName"/>
<OutputClaim ClaimTypeReferenceId="surname" PartnerClaimType="familyName"/>
<OutputClaim ClaimTypeReferenceId="extension_dobirth" PartnerClaimType="birthday"/>
<OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="email"/>
<OutputClaim ClaimTypeReferenceId="countryCode" PartnerClaimType="contacts.mobile.countryCode"/>
<OutputClaim ClaimTypeReferenceId="mobileNumber" PartnerClaimType="contacts.mobile.mobileNumber"/>
<OutputClaim ClaimTypeReferenceId="countryCode" PartnerClaimType="contacts.office.countryCode"/>
<OutputClaim ClaimTypeReferenceId="officeNumber" PartnerClaimType="contacts.office.officeNumber"/>
<OutputClaim ClaimTypeReferenceId="signInName" PartnerClaimType="username"/>
<OutputClaim ClaimTypeReferenceId="objectId" DefaultValue="123456ABCDEF" AlwaysUseDefaultValue="true"/>
</OutputClaims>
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
</ClaimsProviders>
<UserJourneys xmlns="http://schemas.microsoft.com/online/cpim/schemas/2013/06">
<UserJourney Id="Test_CustomerIdentity_API">
<OrchestrationSteps>
<OrchestrationStep Order="1" Type="ClaimsExchange">
<ClaimsExchanges>
<ClaimsExchange Id="Identity-API" TechnicalProfileReferenceId="REST-Identity-API"/>
</ClaimsExchanges>
</OrchestrationStep>
<OrchestrationStep Order="2" Type="SendClaims" CpimIssuerTechnicalProfileReferenceId="JwtIssuer"/>
</OrchestrationSteps>
<ClientDefinition ReferenceId="DefaultWeb"/>
</UserJourney>
</UserJourneys>
<RelyingParty>
<DefaultUserJourney ReferenceId="Test_CustomerIdentity_API"/>
<TechnicalProfile Id="PolicyProfile">
<DisplayName>PolicyProfile</DisplayName>
<Protocol Name="OpenIdConnect"/>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="id"/>
<OutputClaim ClaimTypeReferenceId="givenName"/>
<OutputClaim ClaimTypeReferenceId="surname"/>
<OutputClaim ClaimTypeReferenceId="email"/>
<OutputClaim ClaimTypeReferenceId="extension_dobirth"/>
<OutputClaim ClaimTypeReferenceId="countryCode"/>
<OutputClaim ClaimTypeReferenceId="mobileNumber"/>
<OutputClaim ClaimTypeReferenceId="countryCode"/>
<OutputClaim ClaimTypeReferenceId="officeNumber"/>
<OutputClaim ClaimTypeReferenceId="signInName"/>
<OutputClaim ClaimTypeReferenceId="objectId" PartnerClaimType="sub"/>
</OutputClaims>
<SubjectNamingInfo ClaimType="sub"/>
</TechnicalProfile>
</RelyingParty>
</TrustFrameworkPolicy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment