Verify JWT token with NetScaler unauthenticated
So lets say you have tried the wonderful feature with 401 based oauth action to verify JWT tokens.
It works great when it works, but there could also be other situations where it does not fulfil the need.
It works great when it works, but there could also be other situations where it does not fulfil the need.
Sometimes tokens are not passed in the standard authorization header, correct attributes might not be there or there could be challenges with cookies at client side.
JWT_VERIFY_CERTKEY can be used to verify signature with locally installed certs. This is an example of how you can verify multiple cert keys.
HTTP.REQ.HEADER("Authorization").AFTER_STR("Bearer ").JWT_VERIFY_CERTKEY("cert-1").NOT && HTTP.REQ.HEADER("Authorization").AFTER_STR("Bearer ").JWT_VERIFY_CERTKEY("cert-2").NOT && HTTP.REQ.HEADER("Authorization").AFTER_STR("Bearer ").JWT_VERIFY_CERTKEY("cert-3).NOT
How will you know if these tokens are not too old and expired? This is an example which you can use where the NS would verify that the tokens expire time is not older than 24 hours.
HTTP.REQ.HEADER("Authorization").AFTER_STR("Bearer ").AFTER_STR(".").BEFORE_STR(".").B64DECODE.AFTER_STR("exp\":").BEFORE_STR(",\"aio").TYPECAST_NUM_T(DECIMAL) < SYS.NANO_TIME.DIV(1000000000).SUB(86400)
Can be used together with a respondwith action:
"HTTP/1.1 401 Unauthorized "
So lets say you can use the built-in 401 oauth action working successfully, but you are struggling with getting the samesite attribute set to NONE in NSC_TMAS cookie?
For version 13.1 you can set this in the system wide AAA settings, then it works.
In 14.1 it seems to be fixed, it can be set on AAA server level.
Comments
Post a Comment