use of com.auth0.jwt.JWTVerifier in project balcaovirtual by trf2-jus-br.
the class ProcessoValidarGet method verify.
public static Map<String, Object> verify(String jwt) throws InvalidKeyException, NoSuchAlgorithmException, IllegalStateException, SignatureException, IOException, JWTVerifyException {
final JWTVerifier verifier = new JWTVerifier(Utils.getApiPassword());
Map<String, Object> map;
map = verifier.verify(jwt);
return map;
}
use of com.auth0.jwt.JWTVerifier in project balcaovirtual by trf2-jus-br.
the class CertidaoObterTokenGet method verify.
public static Map<String, Object> verify(String jwt) throws InvalidKeyException, NoSuchAlgorithmException, IllegalStateException, SignatureException, IOException, JWTVerifyException {
final JWTVerifier verifier = new JWTVerifier(Utils.getApiPassword());
Map<String, Object> map;
map = verifier.verify(jwt);
return map;
}
use of com.auth0.jwt.JWTVerifier in project balcaovirtual by trf2-jus-br.
the class AutenticarPost method verify.
public static Map<String, Object> verify(String jwt) throws SwaggerAuthorizationException {
final JWTVerifier verifier = new JWTVerifier(Utils.getJwtPassword());
Map<String, Object> map;
try {
map = verifier.verify(jwt);
} catch (InvalidKeyException | NoSuchAlgorithmException | IllegalStateException | SignatureException | IOException | JWTVerifyException e) {
throw new SwaggerAuthorizationException(e);
}
return map;
}
use of com.auth0.jwt.JWTVerifier in project iet-hf-2022-k-k-k-k-k-k by BME-MIT-IET.
the class JwtUtil method getDecodedJWT.
public static DecodedJWT getDecodedJWT(String authorizationHeader) {
String token = authorizationHeader.substring("Bearer ".length());
Algorithm algorithm = Algorithm.HMAC256(SecurityConfig.getSecretKey().getBytes());
JWTVerifier verifier = JWT.require(algorithm).build();
return verifier.verify(token);
}
use of com.auth0.jwt.JWTVerifier in project brapi-Java-TestServer by plantbreeding.
the class BrapiTestServerJWTAuthFilter method validateOAuthToken.
private String validateOAuthToken(HttpServletRequest request) {
try {
String token = request.getHeader("Authorization");
if (token != null) {
token = token.replaceFirst("Bearer ", "");
RSAPublicKey pubKey = getPublicKey(oidcDiscoveryUrl);
Algorithm algorithm = Algorithm.RSA256(pubKey, null);
JWTVerifier verifier = JWT.require(algorithm).withIssuer("https://auth.brapi.org/auth/realms/brapi").build();
DecodedJWT jwt = verifier.verify(token);
return jwt.getClaim("email").asString();
}
return null;
} catch (Exception e) {
return null;
}
}
Aggregations