Interface Claims

  • All Superinterfaces:
    java.util.Map<java.lang.String,​java.lang.Object>

    public interface Claims
    extends java.util.Map<java.lang.String,​java.lang.Object>
    The Claims interface represents JSON Web Token (JWT) payload claims and offers convenient get methods for some of the well known JWT claims such as "iss", "exp", and "iat".
    Since:
    1.0
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String AUDIENCE
      The AUDIENCE is used to represent the "aud" claim
      static java.lang.String AZP
      The AZP is used to represent the "azp" claim
      static java.lang.String EXPIRATION
      The EXPIRATION is used to represent the "exp" claim
      static java.lang.String ID
      The ID is used to represent the "jti" claim
      static java.lang.String ISSUED_AT
      The ISSUED_AT is used to represent the "iat" claim
      static java.lang.String ISSUER
      The ISSUER is used to represent the "iss" claim
      static java.lang.String NOT_BEFORE
      The NOT_BEFORE is used to represent the "nbf" claim
      static java.lang.String SUBJECT
      The SUBJECT is used to represent the "sub" claim
      static java.lang.String TOKEN_TYPE
      The TOKEN_TYPE is used to represent the "token_type" claim
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.Object> getAllClaims()  
      java.util.List<java.lang.String> getAudience()  
      java.lang.String getAuthorizedParty()  
      <T> T getClaim​(java.lang.String claimName, java.lang.Class<T> requiredType)  
      long getExpiration()  
      long getIssuedAt()  
      java.lang.String getIssuer()  
      java.lang.String getJwtId()  
      long getNotBefore()  
      java.lang.String getSubject()  
      java.lang.String toJsonString()  
      • Methods inherited from interface java.util.Map

        clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
    • Field Detail

      • ISSUER

        static final java.lang.String ISSUER
        The ISSUER is used to represent the "iss" claim
        See Also:
        Constant Field Values
      • SUBJECT

        static final java.lang.String SUBJECT
        The SUBJECT is used to represent the "sub" claim
        See Also:
        Constant Field Values
      • AUDIENCE

        static final java.lang.String AUDIENCE
        The AUDIENCE is used to represent the "aud" claim
        See Also:
        Constant Field Values
      • EXPIRATION

        static final java.lang.String EXPIRATION
        The EXPIRATION is used to represent the "exp" claim
        See Also:
        Constant Field Values
      • NOT_BEFORE

        static final java.lang.String NOT_BEFORE
        The NOT_BEFORE is used to represent the "nbf" claim
        See Also:
        Constant Field Values
      • ISSUED_AT

        static final java.lang.String ISSUED_AT
        The ISSUED_AT is used to represent the "iat" claim
        See Also:
        Constant Field Values
      • ID

        static final java.lang.String ID
        The ID is used to represent the "jti" claim
        See Also:
        Constant Field Values
      • AZP

        static final java.lang.String AZP
        The AZP is used to represent the "azp" claim
        See Also:
        Constant Field Values
      • TOKEN_TYPE

        static final java.lang.String TOKEN_TYPE
        The TOKEN_TYPE is used to represent the "token_type" claim
        See Also:
        Constant Field Values
    • Method Detail

      • getIssuer

        java.lang.String getIssuer()
        Returns:
        The "iss" claim
      • getSubject

        java.lang.String getSubject()
        Returns:
        The "sub" claim
      • getAudience

        java.util.List<java.lang.String> getAudience()
        Returns:
        The "aud" claim
      • getExpiration

        long getExpiration()
        Returns:
        The "exp" claim
      • getNotBefore

        long getNotBefore()
        Returns:
        The "nbf" claim
      • getIssuedAt

        long getIssuedAt()
        Returns:
        The "iat" claim
      • getJwtId

        java.lang.String getJwtId()
        Returns:
        The "jti" claim
      • getAuthorizedParty

        java.lang.String getAuthorizedParty()
        Returns:
        The "azp" claim
      • getClaim

        <T> T getClaim​(java.lang.String claimName,
                       java.lang.Class<T> requiredType)
        Parameters:
        claimName - claim name
        requiredType - This is the required type of the claim value
        Returns:
        The claim value that matches the requiredType
      • getAllClaims

        java.util.Map<java.lang.String,​java.lang.Object> getAllClaims()
        Returns:
        All the claims
      • toJsonString

        java.lang.String toJsonString()
        Returns:
        All the claims in JSON string format