use of com.auth0.jwt.ClaimSet in project nextprot-api by calipho-sib.
the class JWTCodecImpl method encodeJWT.
@Override
public String encodeJWT(Map<String, Object> properties, int expiration) {
String payload, token;
try {
JwtSigner jwtSigner = new JwtSigner();
payload = new ObjectMapper().writeValueAsString(properties);
ClaimSet claimSet = new ClaimSet();
claimSet.setExp(expiration);
token = jwtSigner.encode(Algorithm.HS256, payload, "payload", new String(Base64.decodeBase64(clientSecret)), claimSet);
} catch (JsonProcessingException e) {
throw new SecurityException(e);
} catch (Exception e) {
throw new SecurityException(e);
}
return token;
}
Aggregations