Set Context variable does not set time in seconds .
search cancel

Set Context variable does not set time in seconds .

book

Article ID: 384378

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

According to documentation you should be able to set a variable with the seconds timestamp.

https://techdocs.broadcom.com/us/en/ca-enterprise-software/layer7-api-management/api-gateway/11-0/policy-assertions/assertion-palette/policy-logic-assertions/set-context-variable-assertion.html

This is needed to set a JWT validity with a time value + 1 day (offset).

This does not work as the variable is always returned as  UTC formatted.

Cause

The format tab is used to choose a format from the drop-down list. The assertion uses this format to interpret the value in the Expression field. The default is "<auto>", which means the assertion tries to determine the format automatically.

Resolution

To get the variable time value in seconds (Epoch Time ) you can use the following syntax. 

${timevariablename.seconds}

https://techdocs.broadcom.com/us/en/ca-enterprise-software/layer7-api-management/api-gateway/10-1/reference/context-variables/date-and-time-variables.html