use of org.nextprot.api.security.service.exception.NextprotSecurityException in project nextprot-api by calipho-sib.
the class JWTCodecImpl method decodeJWT.
@Override
public Map<String, Object> decodeJWT(String token) {
JWTVerifier jwtVerifier = new JWTVerifier(clientSecret, clientId);
Map<String, Object> verify;
try {
verify = jwtVerifier.verify(token);
String payload = (String) verify.get("payload");
Map<String, Object> map = new ObjectMapper().readValue(payload, Map.class);
return map;
} catch (InvalidKeyException e) {
throw new NextprotSecurityException(e);
} catch (NoSuchAlgorithmException e) {
throw new NextprotSecurityException(e);
} catch (IllegalStateException e) {
throw new NextprotSecurityException(e);
} catch (SignatureException e) {
throw new NextprotSecurityException(e);
} catch (IOException e) {
throw new NextprotSecurityException(e);
}
}
Aggregations