Package com.nimbusds.jose
Class PlainObject
- java.lang.Object
-
- com.nimbusds.jose.JOSEObject
-
- com.nimbusds.jose.PlainObject
-
- All Implemented Interfaces:
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
-
-
Field Summary
-
Fields inherited from class com.nimbusds.jose.JOSEObject
MIME_TYPE_COMPACT, MIME_TYPE_JS
-
-
Constructor Summary
Constructors Constructor Description PlainObject(Payload payload)Creates a new unsecured JOSE object with a defaultPlainHeaderand the specified payload.PlainObject(PlainHeader header, Payload payload)Creates a new unsecured JOSE object with the specified header and payload.PlainObject(Base64URL firstPart, Base64URL secondPart)Creates a new unsecured JOSE object with the specified Base64URL-encoded parts.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PlainHeadergetHeader()Returns the header of this JOSE object.static PlainObjectparse(String s)Parses an unsecured JOSE object from the specified string in compact format.Stringserialize()Serialises this unsecured JOSE object to its compact format consisting of Base64URL-encoded parts delimited by period ('.') characters.-
Methods inherited from class com.nimbusds.jose.JOSEObject
getParsedParts, getParsedString, getPayload, setParsedParts, setPayload, split
-
-
-
-
Constructor Detail
-
PlainObject
public PlainObject(Payload payload)
Creates a new unsecured JOSE object with a defaultPlainHeaderand the specified payload.- Parameters:
payload- The payload. Must not benull.
-
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 benull.payload- The payload. Must not benull.
-
PlainObject
public PlainObject(Base64URL firstPart, Base64URL secondPart) throws 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 benull.secondPart- The second part, corresponding to the payload. Must not benull.- Throws:
ParseException- If parsing of the serialised parts failed.
-
-
Method Detail
-
getHeader
public PlainHeader getHeader()
Description copied from class:JOSEObjectReturns the header of this JOSE object.- Specified by:
getHeaderin classJOSEObject- Returns:
- The header.
-
serialize
public 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:
serializein classJOSEObject- Returns:
- The serialised unsecured JOSE object.
-
parse
public static PlainObject parse(String s) throws ParseException
Parses an unsecured JOSE object from the specified string in compact format.- Parameters:
s- The string to parse. Must not benull.- Returns:
- The unsecured JOSE object.
- Throws:
ParseException- If the string couldn't be parsed to a valid unsecured JOSE object.
-
-