Class UnverifiedJsonWebToken

java.lang.Object
com.palantir.tokens.auth.UnverifiedJsonWebToken

@Safe @Immutable(builder=false, copy=false) public abstract class UnverifiedJsonWebToken extends Object
Represents the parsed form of a JWT but does not verify the token signature.

The information provided by this class should not be used for any security-sensitive application unless verified through some other process (e.g. by querying another service known to perform validation).

An anticipated use of this class is making a best-effort user id extraction for logging.

  • Constructor Details

    • UnverifiedJsonWebToken

      public UnverifiedJsonWebToken()
  • Method Details

    • getUnverifiedUserId

      @Safe @Parameter public abstract @Safe String getUnverifiedUserId()
      Returns the unverified user id, i.e., the "sub" claim, of the JWT.
    • getUnverifiedSessionId

      @Safe @Parameter public abstract @Safe Optional<String> getUnverifiedSessionId()
      Returns the unverified session id, i.e. the "sid" claim, of the JWT or absent if the JWT does not contain the "sid" claim.
    • getUnverifiedTokenId

      @Safe @Parameter public abstract @Safe Optional<String> getUnverifiedTokenId()
      Returns the unverified token id, i.e. the "jti" claim, of the JWT or absent if the JWT does not contain the "jti" claim.
    • getUnverifiedOrganizationId

      @Safe @Parameter public abstract @Safe Optional<String> getUnverifiedOrganizationId()
      Returns the unverified organization id, i.e. the "org" claim, of the JWT or absent if the JWT does not contain the "org" claim.
    • getUnverifiedService

      @Safe @Parameter public abstract @Safe Optional<String> getUnverifiedService()
      Returns the unverified first-party service name, i.e. the "svc" claim, of the JWT or absent if the JWT does not contain the "svc" claim.
    • tryParse

      public static Optional<UnverifiedJsonWebToken> tryParse(String rawAuthHeader)
      Does a lower cost check on the structure of string provided before attempting to create an UnverifiedJsonWebToken.
    • of

      public static UnverifiedJsonWebToken of(BearerToken token)
      Attempts to create an UnverifiedJsonWebToken from provided BearerToken.

      The information provided by this class should not be used for any security-sensitive application unless verified through some other process (e.g. by querying another service known to perform validation).

      An anticipated use of this class is making a best-effort user id extraction for logging.