Skip to content

Commit

Permalink
verify signature when parsing refresh token
Browse files Browse the repository at this point in the history
Signed-off-by: Kai Helbig <[email protected]>
  • Loading branch information
ostrya committed May 31, 2023
1 parent a4cf8b5 commit 5adb0ff
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import com.tngtech.keycloakmock.api.TokenConfig;
import com.tngtech.keycloakmock.impl.session.UserData;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Header;
import io.jsonwebtoken.Jwt;
import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.JwtParser;
import io.jsonwebtoken.Jwts;
Expand Down Expand Up @@ -102,10 +99,9 @@ public String getToken(
.compact();
}

@SuppressWarnings("unchecked")
public Map<String, Object> parseToken(String token) {
JwtParser parser = Jwts.parserBuilder().setSigningKey(privateKey).build();
return ((Jwt<Header<?>, Claims>) parser.parse(token)).getBody();
return parser.parseClaimsJws(token).getBody();
}

private void setClaimIfPresent(
Expand Down

0 comments on commit 5adb0ff

Please sign in to comment.