diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/security/jwt/JWTValidator.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/security/jwt/JWTValidator.java index 2a04d6ff6639..bb1f2c9f2110 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/security/jwt/JWTValidator.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/security/jwt/JWTValidator.java @@ -157,13 +157,6 @@ public AuthenticationContext authenticate(SignedJWTInfo signedJWTInfo, MessageCo String jwtTokenIdentifier = getJWTTokenIdentifier(signedJWTInfo); String jwtHeader = signedJWTInfo.getSignedJWT().getHeader().toString(); - long jwtGeneratedTime = 0; - try { - jwtGeneratedTime = signedJWTInfo.getSignedJWT().getJWTClaimsSet().getIssueTime().getTime(); - } catch (ParseException e) { - log.error("Error while obtaining JWT token generated time certificate. " - + GatewayUtils.getMaskedToken(jwtHeader)); - } // Check for CNF validation if (!isCNFValidationDisabled(disableCNFValidation, false)) { try { @@ -187,6 +180,12 @@ public AuthenticationContext authenticate(SignedJWTInfo signedJWTInfo, MessageCo } Object authorizedPartyClaim = signedJWTInfo.getJwtClaimsSet().getClaim(APIMgtGatewayConstants.AZP_JWT_CLAIM); Object entityIdClaim = signedJWTInfo.getJwtClaimsSet().getClaim(APIMgtGatewayConstants.ENTITY_ID_JWT_CLAIM); + long jwtGeneratedTime = 0; + try { + jwtGeneratedTime = signedJWTInfo.getSignedJWT().getJWTClaimsSet().getIssueTime().getTime(); + } catch (ParseException e) { + log.error("Error while obtaining JWT token generated time " + GatewayUtils.getMaskedToken(jwtHeader)); + } if (jwtGeneratedTime != 0 && authorizedPartyClaim != null && entityIdClaim != null) { String authorizedParty = (String) authorizedPartyClaim; String entityId = (String) entityIdClaim;