Class Jwt

java.lang.Object
com.revetsec.jose.Jwt

@Immutable public final class Jwt extends Object
A JWT that JwtValidator.validateResult(String) accepted: its signature verified with a trusted key, and its type, issuer, audience, lifetime and required claims passed. Only a validator creates one, so holding a Jwt means the token was validated.

The token is a bearer credential. toCompactSerialization() returns it as received, for code that must forward it; toString() shows only the algorithm. Instances compare by reference, never by content.

Since:
1.0.0
Author:
Mark Allen
  • Method Details

    • getAlgorithm

      Returns the algorithm the token was signed with (alg).
      Returns:
      the algorithm
      Since:
      1.0.0
    • getKeyId

      Returns the header's key ID (kid), which named the key that verified the token.
      Returns:
      the key ID, or empty if the header has none
      Since:
      1.0.0
    • getType

      Returns the header's type (typ) exactly as received, before the comparison that folds case and implies application/.
      Returns:
      the type, or empty if the header has none
      Since:
      1.0.0
    • getClaims

      Returns the token's claims.
      Returns:
      the claims
      Since:
      1.0.0
    • toCompactSerialization

      Returns the token exactly as it was received: a bearer credential, so treat it as a secret.
      Returns:
      the compact serialization
      Since:
      1.0.0
    • toString

      Describes the token by its algorithm only.
      Overrides:
      toString in class Object
      Returns:
      the description, without the token or its claims
      Since:
      1.0.0