Interface JWTParser

All Known Implementing Classes:
DefaultJWTParser

public interface JWTParser
A parser to parse a JWT token and convert it to a JsonWebToken.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.eclipse.microprofile.jwt.JsonWebToken
    decrypt(String token, String secret)
    Parse JWT token.
    org.eclipse.microprofile.jwt.JsonWebToken
    decrypt(String token, PrivateKey key)
    Parse JWT token.
    org.eclipse.microprofile.jwt.JsonWebToken
    decrypt(String token, SecretKey key)
    Parse JWT token.
    org.eclipse.microprofile.jwt.JsonWebToken
    parse(String token)
    Parse JWT token.
    org.eclipse.microprofile.jwt.JsonWebToken
    parse(String token, JWTAuthContextInfo context)
    Parse JWT token.
    org.eclipse.microprofile.jwt.JsonWebToken
    Parse an already verified signed JWT token.
    org.eclipse.microprofile.jwt.JsonWebToken
    verify(String token, String secret)
    Parse JWT token.
    org.eclipse.microprofile.jwt.JsonWebToken
    verify(String token, PublicKey key)
    Parse JWT token.
    org.eclipse.microprofile.jwt.JsonWebToken
    verify(String token, SecretKey key)
    Parse JWT token.
  • Method Details

    • parse

      org.eclipse.microprofile.jwt.JsonWebToken parse(String token) throws ParseException
      Parse JWT token. The token will be verified or decrypted or decrypted and then verified and converted to JsonWebToken. This method depends on the injected JWTAuthContextInfo configuration context.
      Parameters:
      token - the JWT token
      Returns:
      JsonWebToken
      Throws:
      ParseException - parse exception
    • parse

      org.eclipse.microprofile.jwt.JsonWebToken parse(String token, JWTAuthContextInfo context) throws ParseException
      Parse JWT token. The token will be verified or decrypted or decrypted and then verified and converted to JsonWebToken.
      Parameters:
      token - the JWT token
      context - the configuration context which will override the injected JWTAuthContextInfo configuration context.
      Returns:
      JsonWebToken
      Throws:
      ParseException - parse exception
    • verify

      org.eclipse.microprofile.jwt.JsonWebToken verify(String token, PublicKey key) throws ParseException
      Parse JWT token. The token will be verified and converted to JsonWebToken.
      Parameters:
      token - the JWT token
      key - the public verification key. The injected JWTAuthContextInfo configuration context will be reused, only its publicVerificationKey property will be replaced by this parameter.
      Returns:
      JsonWebToken
      Throws:
      ParseException - parse exception
    • verify

      org.eclipse.microprofile.jwt.JsonWebToken verify(String token, SecretKey key) throws ParseException
      Parse JWT token. The token will be verified and converted to JsonWebToken.
      Parameters:
      token - the JWT token
      key - the secret verification key. The injected JWTAuthContextInfo configuration context will be reused, only its secretVerificationKey property will be replaced by this parameter.
      Returns:
      JsonWebToken
      Throws:
      ParseException - parse exception
    • verify

      org.eclipse.microprofile.jwt.JsonWebToken verify(String token, String secret) throws ParseException
      Parse JWT token. The token will be verified and converted to JsonWebToken.
      Parameters:
      token - the JWT token
      secret - the secret. The injected JWTAuthContextInfo configuration context will be reused, only its secretVerificationKey property will be replaced after converting this parameter to SecretKey.
      Returns:
      JsonWebToken
      Throws:
      ParseException - parse exception
    • decrypt

      org.eclipse.microprofile.jwt.JsonWebToken decrypt(String token, PrivateKey key) throws ParseException
      Parse JWT token. The token will be decrypted and converted to JsonWebToken.
      Parameters:
      token - the JWT token
      key - the private decryption key. The injected JWTAuthContextInfo configuration context will be reused, only its privateDecryptionkey property will be replaced by this parameter.
      Returns:
      JsonWebToken
      Throws:
      ParseException - parse exception
    • decrypt

      org.eclipse.microprofile.jwt.JsonWebToken decrypt(String token, SecretKey key) throws ParseException
      Parse JWT token. The token will be decrypted and converted to JsonWebToken.
      Parameters:
      token - the JWT token
      key - the secret decryption key. The injected JWTAuthContextInfo configuration context will be reused, only its secretDecryptionkey property will be replaced by this parameter.
      Returns:
      JsonWebToken
      Throws:
      ParseException - parse exception
    • decrypt

      org.eclipse.microprofile.jwt.JsonWebToken decrypt(String token, String secret) throws ParseException
      Parse JWT token. The token will be decrypted and converted to JsonWebToken.
      Parameters:
      token - the JWT token
      secret - the secret. The injected JWTAuthContextInfo configuration context will be reused, only its secretDecryptionkey property will be replaced will be replaced after converting this parameter to SecretKey.
      Returns:
      JsonWebToken
      Throws:
      ParseException - parse exception
    • parseOnly

      org.eclipse.microprofile.jwt.JsonWebToken parseOnly(String token) throws ParseException
      Parse an already verified signed JWT token. Use this method only if the token has been verified by the secure gateway or other systems.
      Throws:
      ParseException