Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEPPER-977 [DSM] check jwt to make sure expiration claim is present #2659

Merged
merged 4 commits into from
Aug 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.TokenExpiredException;
import com.auth0.jwt.impl.PublicClaims;
import com.auth0.jwt.interfaces.Claim;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.auth0.jwt.interfaces.RSAKeyProvider;
Expand Down Expand Up @@ -219,6 +220,10 @@ public static Optional<DecodedJWT> verifyAuth0Token(String jwt, String auth0Doma
}
JWTVerifier verifier = verification.build();
validToken = verifier.verify(jwt);
if (validToken.getClaim(PublicClaims.EXPIRES_AT).isNull()){
logger.warn("Token missing expiration time in the claims.");
return Optional.empty();
}
} catch (TokenExpiredException expiredError) {
logger.info("WARNING: Token has expired {}", jwt, expiredError);
} catch (Exception error) {
Expand Down
Loading