use of com.auth0.spring.security.api.authentication.AuthenticationJsonWebToken in project c4sg-services by Code4SocialGood.
the class JwtUtil method match.
/**
* Checks if the email matches
* @param email Email address
* @return True if match
*/
public static boolean match(String email) {
AuthenticationJsonWebToken auth = (AuthenticationJsonWebToken) SecurityContextHolder.getContext().getAuthentication();
if (auth != null) {
DecodedJWT jwt = (DecodedJWT) auth.getDetails();
String emailFromClaim = jwt.getClaim("http://email").asString();
if (email.equals(emailFromClaim))
return true;
}
return false;
}
Aggregations