Skip to content

Commit

Permalink
only try to validate after checking if the token is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBaldo committed Oct 19, 2023
1 parent 9034f09 commit 187ca84
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,12 @@ public Result writeSetCookieResponse(RelayedHttpListenerContext context) {

// Get token from request
var unverifiedAuthToken = Utils.getTokenFromAuthorization(context.getRequest().getHeaders());
// Verify the JWT signature
JWTVerifier.BaseVerification verifier = (JWTVerifier.BaseVerification);
DecodedJWT authToken = verifier.build().verify(unverifiedAuthToken);

if (authToken.isEmpty()) {
if (unverifiedAuthToken.isEmpty()) {
return Result.FAILURE;
}
// Verify the JWT signature
JWTVerifier.BaseVerification verifier = (JWTVerifier.BaseVerification);
DecodedJWT authToken = verifier.build().verify(unverifiedAuthToken.toString());

Map<String, String> requestHeaders = context.getRequest().getHeaders();

Expand Down

0 comments on commit 187ca84

Please sign in to comment.