Class JwtValidator

java.lang.Object
org.wildfly.security.auth.realm.token.validator.JwtValidator
All Implemented Interfaces:
TokenValidator

public class JwtValidator extends Object implements TokenValidator

A TokenValidator capable of validating and parsing JWT. Most of the validations performed by this validator are based on RFC-7523 (JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants).

This validator can also be used as a JWT parser only. In this case, for security reasons, you need to make sure that JWT validations such as issuer, audience and signature checks are performed before obtaining identities from this realm.

Author:
Pedro Igor
  • Method Details

    • builder

      public static JwtValidator.Builder builder()
      Returns a JwtValidator.Builder instance that can be used to configure and create a JwtValidator.
      Returns:
      a JwtValidator.Builder instance
    • validate

      public org.wildfly.security.authz.Attributes validate(org.wildfly.security.evidence.BearerTokenEvidence evidence) throws org.wildfly.security.auth.server.RealmUnavailableException
      Description copied from interface: TokenValidator

      Validates a BearerTokenEvidence and returns an Attributes instance containing all information within a security token passed through evidence.

      Specified by:
      validate in interface TokenValidator
      Parameters:
      evidence - a BearerTokenEvidence holding the security token to validate
      Returns:
      an Attributes instance containing all information from the security token, when valid. Otherwise, this method returns null to indicate that the security token is invalid
      Throws:
      org.wildfly.security.auth.server.RealmUnavailableException - if any error occurs when validating the evidence