question

JohnMariaAntony-3674 avatar image
0 Votes"
JohnMariaAntony-3674 asked haelshab answered

Is it possible to convert string claimtype to int claimtype in B2C?

Hi Team,

I have a requirement that I need to get a value from the URL (a querystring datetime value) and compare it with the current dateTime in B2C policy.
As you can see these two are different datatypes (string, dateTime), Are there any claims transformation that I can use to convert a string to dateTime and vice versa?

Similarly, is it possible to convert an string to an Integer in B2C policy.

Appreciate your help.

John

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

haelshab avatar image
0 Votes"
haelshab answered

Claims are intended to be persisted and transferred in string format. However, for the purpose of comparisons, you can convert string to datetime in order to make decisions in your policy based on equality.

Here is an example of getting current DateTime, which you can later use for equality comparison: date-transformations

Here is an example of DateTime comparison, which you can use to assert that two DateTime claims are within a specific time span: date-transformations

Finally, here is an example of converting Integer claims to string, which you can later use for a normal string equality comparison: integer-transformations


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.