I have the following syntax for policy which works for only one certificate when passed with the GET Request.
<choose>
<when condition="@(context.Request.Certificate != null && !context.Request.Certificate.Issuer.Contains("CN=itv.mit-xperts.com"))">
<return-response>
<set-status code="403" reason="Invalid client certificate Issuer" />
</return-response>
</when>
</choose>
If I use the policy to validate between two certificates, then it will always go to 403 because the OR statement always returns true:
<choose>
<when condition="@((context.Request.Certificate != null) && (!context.Request.Certificate.Issuer.Contains("CN=itv.mit-xperts.com") || !context.Request.Certificate.Issuer.Contains("CN=DigiCert Test SHA2 Intermediate CA-1")))">
<return-response>
<set-status code="403" reason="Invalid client certificate Issuer" />
</return-response>
</when>
</choose>
The API works without certificate, but if a Certificate is passed, then "when" tag may or may not take action. I want the condition to go to 403 only when a certificate with any other Issuer is used. The Issuer Information contains many different attributes according to the certificate but CN=some-text remains common.
I have no knowledge regarding XML and its syntax or functions.
The following Microsoft Docs may help, but I did not find any syntax that may help:
https://docs.microsoft.com/en-us/azure/api-management/api-management-policy-expressions
https://docs.microsoft.com/en-us/azure/api-management/api-management-transformation-policies