question

MaluendaMirandaCristianG-8363 avatar image
0 Votes"
MaluendaMirandaCristianG-8363 asked amanpreetsingh-msft commented

Custom Policies - How can I check if a query parameter is present or not in the request?

Hi,

I am using the Claims Resolver "{OAUTH-KV:any custom query string}" to read a query parameter. That works fine but my problem is, that I need to set a default value when the query parameter is not part of the request.

The problem that I am having is Azure creates a Claim Type null, so there is no way to use a "precondition" in the UserJourney to do some logic. ClaimsExist is always true, and ClaimEquals doesn't work if I compare it against the value "Null" or an empty string.

I know that I could pass always a default value (Something like "skip"). So, I can use the ClaimEquals and check if the value is "skip." The problem with this solution is not backward compatible and it will break old clients.

Any suggestion on what can I do?

Thanks.

azure-ad-b2c
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MaluendaMirandaCristianG-8363 avatar image
0 Votes"
MaluendaMirandaCristianG-8363 answered amanpreetsingh-msft commented

In the end, I used two query parameters. One is for the input that I need, and the other is a true/false flag. So, I can do this:

                 <OrchestrationStep Order="2" Type="ClaimsExchange">
                     <Preconditions>
                         <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
                             <Value>useCustomCorrelationId</Value>
                             <Value>true</Value>
                             <Action>SkipThisOrchestrationStep</Action>
                         </Precondition>
                     </Preconditions>
                     <ClaimsExchanges>
                         <ClaimsExchange Id="set-azure-correlation-id" TechnicalProfileReferenceId="set-azure-correlation-id" />
                     </ClaimsExchanges>
                 </OrchestrationStep>
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for posting the solution.

0 Votes 0 ·