Class PlainObject

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    PlainJWT

    @ThreadSafe
    public class PlainObject
    extends JOSEObject
    Unsecured (plain / alg=none) JOSE object. This class is thread-safe.
    Version:
    2014-04-08
    Author:
    Vladimir Dzhuvinov
    See Also:
    Serialized Form
    • Constructor Detail

      • PlainObject

        public PlainObject​(Payload payload)
        Creates a new unsecured JOSE object with a default PlainHeader and the specified payload.
        Parameters:
        payload - The payload. Must not be null.
      • PlainObject

        public PlainObject​(PlainHeader header,
                           Payload payload)
        Creates a new unsecured JOSE object with the specified header and payload.
        Parameters:
        header - The unsecured header. Must not be null.
        payload - The payload. Must not be null.
      • PlainObject

        public PlainObject​(Base64URL firstPart,
                           Base64URL secondPart)
                    throws java.text.ParseException
        Creates a new unsecured JOSE object with the specified Base64URL-encoded parts.
        Parameters:
        firstPart - The first part, corresponding to the unsecured header. Must not be null.
        secondPart - The second part, corresponding to the payload. Must not be null.
        Throws:
        java.text.ParseException - If parsing of the serialised parts failed.
    • Method Detail

      • serialize

        public java.lang.String serialize()
        Serialises this unsecured JOSE object to its compact format consisting of Base64URL-encoded parts delimited by period ('.') characters.
         [header-base64url].[payload-base64url].[]
         
        Specified by:
        serialize in class JOSEObject
        Returns:
        The serialised unsecured JOSE object.
      • parse

        public static PlainObject parse​(java.lang.String s)
                                 throws java.text.ParseException
        Parses an unsecured JOSE object from the specified string in compact format.
        Parameters:
        s - The string to parse. Must not be null.
        Returns:
        The unsecured JOSE object.
        Throws:
        java.text.ParseException - If the string couldn't be parsed to a valid unsecured JOSE object.