@Test public void getClaimsExtended() { final String sub = "TestSubjectY"; final String auth = "ROLE_X;ROLE_Y"; final long expiresIn = 99999999; final String token = jwtService.createToken(sub, auth, expiresIn); final String randomKey = "randomKey"; final Map<String, Object> claims = jwtService.getClaimsExtended(token, randomKey, sc.getAuthoritiesHolder()); assertClaimsState(claims, sub, auth); assertNull("Claims contains an incorrect pair key-value", claims.get(randomKey)); assertNotNull("Expiration time is null", claims.get(JWTService.EXPIRATION)); assertTrue("Expiration time is not an instance of Date", claims.get(JWTService.EXPIRATION) instanceof Date); if (claims.get(JWTService.EXPIRATION) != null && claims.get(JWTService.EXPIRATION) instanceof Date) { assertTrue("Expiration time is not greater than the creation time of the token", ((Date) claims.get(JWTService.EXPIRATION)).getTime() > expiresIn); } }
public Map<String, Object> getClaimsExtended(final String claimsJwt, final String... key) { Map<String, Object> r = new HashMap<>(); Claims claims = processClaimsJWT(claimsJwt, r, key); r.put(AUDIENCE, claims.getAudience()); r.put(EXPIRATION, claims.getExpiration()); r.put(ID, claims.getId()); r.put(ISSUED_AT, claims.getIssuedAt()); r.put(ISSUER, claims.getIssuer()); r.put(NOT_BEFORE, claims.getNotBefore()); r.put(SUBJECT, claims.getSubject()); return r; }
JWTService { public Map<String, Object> getClaimsExtended(final String claimsJwt, final String... key) { Map<String, Object> r = new HashMap<>(); Claims claims = processClaimsJWT(claimsJwt, r, key); r.put(AUDIENCE, claims.getAudience()); r.put(EXPIRATION, claims.getExpiration()); r.put(ID, claims.getId()); r.put(ISSUED_AT, claims.getIssuedAt()); r.put(ISSUER, claims.getIssuer()); r.put(NOT_BEFORE, claims.getNotBefore()); r.put(SUBJECT, claims.getSubject()); return r; } }
JWTService { public Map<String, Object> getClaimsExtended(final String claimsJwt, final String... key) { Map<String, Object> r = new HashMap<>(); Claims claims = processClaimsJWT(claimsJwt, r, key); r.put(AUDIENCE, claims.getAudience()); r.put(EXPIRATION, claims.getExpiration()); r.put(ID, claims.getId()); r.put(ISSUED_AT, claims.getIssuedAt()); r.put(ISSUER, claims.getIssuer()); r.put(NOT_BEFORE, claims.getNotBefore()); r.put(SUBJECT, claims.getSubject()); return r; }  }
JWTService { public Map<String, Object> getClaimsExtended(final String claimsJwt, final String... key) { Map<String, Object> r = new HashMap<>(); Claims claims = processClaimsJWT(claimsJwt, r, key); r.put(AUDIENCE, claims.getAudience()); r.put(EXPIRATION, claims.getExpiration()); r.put(ID, claims.getId()); r.put(ISSUED_AT, claims.getIssuedAt()); r.put(ISSUER, claims.getIssuer()); r.put(NOT_BEFORE, claims.getNotBefore()); r.put(SUBJECT, claims.getSubject()); return r; }  long getATokenExpirationTime(); long getRTokenExpirationTime(); String createToken(final String subject); String createToken(final String subject, final long expiresIn); String createToken(final String subject, final String authorities); String createRefreshToken(final String subject, final String authorities); String createToken(final String subject, final String authorities, final long expiresIn); Map<String, Object> getClaims(final String claimsJwt, final String... key); Map<String, Object> createLoginData(final String subject, final String accessToken, final Date issuedAt,
                                               final String authoritiesString, final String refreshToken); Map<String, Object> getClaimsExtended(final String claimsJwt, final String... key); }
JWTService { public Map<String, Object> getClaimsExtended(final String claimsJwt, final String... key) { Map<String, Object> r = new HashMap<>(); Claims claims = processClaimsJWT(claimsJwt, r, key); r.put(AUDIENCE, claims.getAudience()); r.put(EXPIRATION, claims.getExpiration()); r.put(ID, claims.getId()); r.put(ISSUED_AT, claims.getIssuedAt()); r.put(ISSUER, claims.getIssuer()); r.put(NOT_BEFORE, claims.getNotBefore()); r.put(SUBJECT, claims.getSubject()); return r; }  long getATokenExpirationTime(); long getRTokenExpirationTime(); String createToken(final String subject); String createToken(final String subject, final long expiresIn); String createToken(final String subject, final String authorities); String createRefreshToken(final String subject, final String authorities); String createToken(final String subject, final String authorities, final long expiresIn); Map<String, Object> getClaims(final String claimsJwt, final String... key); Map<String, Object> createLoginData(final String subject, final String accessToken, final Date issuedAt,
                                               final String authoritiesString, final String refreshToken); Map<String, Object> getClaimsExtended(final String claimsJwt, final String... key); static final String AUDIENCE; static final String EXPIRATION; static final String ID; static final String ISSUED_AT; static final String ISSUER; static final String NOT_BEFORE; static final String SUBJECT; static final long DEFAULT_ACCESS_TOKEN_EXPIRATION_TIME; static final long DEFAULT_REFRESH_TOKEN_EXPIRATION_TIME; }