Class SignedJWT

    • Constructor Detail

      • SignedJWT

        public SignedJWT​(JWSHeader header,
                         JWTClaimsSet claimsSet)
        Creates a new to-be-signed JSON Web Token (JWT) with the specified header and claims set. The initial state will be unsigned.
        Parameters:
        header - The JWS header. Must not be null.
        claimsSet - The JWT claims set. Must not be null.
      • SignedJWT

        public SignedJWT​(Base64URL firstPart,
                         Base64URL secondPart,
                         Base64URL thirdPart)
                  throws ParseException
        Creates a new signed JSON Web Token (JWT) with the specified serialised parts. The state will be signed.
        Parameters:
        firstPart - The first part, corresponding to the JWS header. Must not be null.
        secondPart - The second part, corresponding to the claims set (payload). Must not be null.
        thirdPart - The third part, corresponding to the signature. Must not be null.
        Throws:
        ParseException - If parsing of the serialised parts failed.
    • Method Detail

      • getJWTClaimsSet

        public JWTClaimsSet getJWTClaimsSet()
                                     throws ParseException
        Description copied from interface: JWT
        Gets the claims set of the JSON Web Token (JWT).
        Specified by:
        getJWTClaimsSet in interface JWT
        Returns:
        The claims set, null if not available (for an encrypted JWT that isn't decrypted).
        Throws:
        ParseException - If the payload of the JWT doesn't represent a valid JSON object and a JWT claims set.
      • setPayload

        protected void setPayload​(Payload payload)
        Description copied from class: JOSEObject
        Sets the payload of this JOSE object.
        Overrides:
        setPayload in class JOSEObject
        Parameters:
        payload - The payload, null if not available (e.g. for an encrypted JWE object).
      • parse

        public static SignedJWT parse​(String s)
                               throws ParseException
        Parses a signed JSON Web Token (JWT) from the specified string in compact format.
        Parameters:
        s - The string to parse. Must not be null.
        Returns:
        The signed JWT.
        Throws:
        ParseException - If the string couldn't be parsed to a valid signed JWT.