Interface JWTProcessor<C extends SecurityContext>

All Known Subinterfaces:
ConfigurableJWTProcessor<C>
All Known Implementing Classes:
DefaultJWTProcessor

public interface JWTProcessor<C extends SecurityContext>
Interface for parsing and processing unsecured (plain), signed and encrypted JSON Web Tokens (JWTs). An optional context parameter is available to facilitate passing of additional data between the caller and the underlying JOSE processor (in both directions).
Version:
2015-08-20
Author:
Vladimir Dzhuvinov
  • Method Summary

    Modifier and Type
    Method
    Description
    process(EncryptedJWT encryptedJWT, C context)
    Processes the specified encrypted JWT by decrypting it.
    process(JWT jwt, C context)
    Processes the specified JWT (unsecured, signed or encrypted).
    process(PlainJWT plainJWT, C context)
    Processes the specified unsecured (plain) JWT, typically by checking its context.
    process(SignedJWT signedJWT, C context)
    Processes the specified signed JWT by verifying its signature.
    process(String jwtString, C context)
    Parses and processes the specified JWT (unsecured, signed or encrypted).
  • Method Details

    • process

      Parses and processes the specified JWT (unsecured, signed or encrypted).
      Parameters:
      jwtString - The JWT, compact-encoded to a URL-safe string. Must not be null.
      context - Optional context, null if not required.
      Returns:
      The JWT claims set on success.
      Throws:
      ParseException - If the string couldn't be parsed to a valid JWT.
      BadJOSEException - If the JWT is rejected.
      JOSEException - If an internal processing exception is encountered.
    • process

      Processes the specified JWT (unsecured, signed or encrypted).
      Parameters:
      jwt - The JWT. Must not be null.
      context - Optional context, null if not required.
      Returns:
      The JWT claims set on success.
      Throws:
      BadJOSEException - If the JWT is rejected.
      JOSEException - If an internal processing exception is encountered.
    • process

      Processes the specified unsecured (plain) JWT, typically by checking its context.
      Parameters:
      plainJWT - The unsecured (plain) JWT. Not null.
      context - Optional context, null if not required.
      Returns:
      The JWT claims set on success.
      Throws:
      BadJOSEException - If the unsecured (plain) JWT is rejected, after examining the context or due to the payload not being a JSON object.
      JOSEException - If an internal processing exception is encountered.
    • process

      Processes the specified signed JWT by verifying its signature. The key candidate(s) are selected by examining the JWS header and / or the message context.
      Parameters:
      signedJWT - The signed JWT. Not null.
      context - Optional context, null if not required.
      Returns:
      The JWT claims set on success.
      Throws:
      BadJOSEException - If the signed JWT is rejected, typically due to a bad signature or the payload not being a JSON object.
      JOSEException - If an internal processing exception is encountered.
    • process

      Processes the specified encrypted JWT by decrypting it. The key candidate(s) are selected by examining the JWS header and / or the message context.
      Parameters:
      encryptedJWT - The encrypted JWT. Not null.
      context - Optional context, null if not required.
      Returns:
      The JWT claims set on success.
      Throws:
      BadJOSEException - If the encrypted JWT is rejected, typically due to failed decryption or the payload not being a JSON object.
      JOSEException - If an internal processing exception is encountered.