azure-ad-b2cazure-ad-graph-apiazure-ad-b2c-custom-policy

Manage Random Query String Values in AD B2C


In this scenario, once a user requests a b2c Login / Registration, every time web-application redirects that requests to b2c and that requests appended with a random query string value each time.

Now, from b2c side we have to read those random / dynamic query string parameters and return query string parameters as a claims in JWT token response to the calling application.

Query parameter example: &xyz=12345 / &token=AGCOMM_678_IRA

Is there any reference to handle these scenario? What do we have to modify in this technical profile to read the random / dynamic query string values?

<ClaimsProvider>
<DisplayName>check Parameter</DisplayName>
<TechnicalProfiles>
<TechnicalProfile Id="Get-Parameters">
<DisplayName>Profile to fill claims with parameter values</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.ClaimsTransformationProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="IncludeClaimResolvingInClaimsHandling">true</Item>
</Metadata>            
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="myParameter" DefaultValue="{oauth-kv:my_parameter}" AlwaysUseDefaultValue="true"/> 
</OutputClaims>
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>

Solution

  • Use claims resolvers.

    e.g.

    <InputClaims>
        <InputClaim ClaimTypeReferenceId="Query" DefaultValue="{OAUTH-KV:xyz}" />
    </InputClaims>
    

    The value of "Query" is then 12345.

    Note:

    Settings: