Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String jwtString = getAccessTokenString(synCtx);
- try {
- AccessTokenVerifier jwtVerifier = JwtVerifiers.accessTokenVerifierBuilder()
- .setIssuer(issuerUrl)
- .setAudience(audience)
- .setConnectionTimeout(Duration.ofSeconds(1)) // defaults to 1000ms
- .setReadTimeout(Duration.ofSeconds(1)) // defaults to 1000ms
- .build();
- Jwt jwt= jwtVerifier.decode(jwtString);
- System.out.println(jwt.getTokenValue()); // print the token
- System.out.println(jwt.getClaims().get("invalidKey")); // an invalid key just returns null
- System.out.println(jwt.getClaims().get("groups")); // handle an array value
- System.out.println(jwt.getExpiresAt()); // print the expiration time
- return true;
- } catch (JwtVerificationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement