Compare Variable Assertion not comparing Dates as expected
search cancel

Compare Variable Assertion not comparing Dates as expected


Article ID: 273261


Updated On:


CA API Gateway


I am trying to compare a date in a JWT to the gateway date and the comparison is not working correctly. I'm pulling the expiration date from the JWT and comparing it to the time in the gateway. In the body of the token below, it's the exp.

{  "sub": "ipaas-api-gateway-testid",  "aud": "fluid-pub",  "res": "{}",  "iss": "iPaaS",  "exp": 1694117259,  "iat": 1694110059,  "jti": "02bbc569-9f65-471d-929e-99b50fa3892b"}

No matter what the time on the gateway is, the assertion passes. I'll attach my experimental Service where I'm returning a canned response or an error. This is the response payload and you can see the expiration is considered not expired.

{  "status":"Not Expired",  "gatewayTime":2023-09-07T20:40:33.000Z,  "tokenExp":2023-09-07T20:07:39.000Z}



Release : 11.0


Compare was wtExpiration less than gatewayTime - this is backwards 


The compare gatewayTime MUST be less than the jwtExpiration to be a valid Token, otherwise it’s expired

I’ve attached a smaller service/endpoint (compare.xml) 


Set context variable with JWT Token with expired token 

Set context variable with current Gateway Date/Time

Evaluate JSON extract the Expiration Time of token

Set context variable with extracted time of token

Block to determine if expired token. Token expire is less than Gateway time 




1694196700937__CompareJWTToken.xml get_app