public abstract class JOSEObjectJSON extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static String |
MIME_TYPE_JOSE_JSON
The MIME type of JOSE objects serialised to JSON:
application/jose+json; charset=UTF-8 |
Modifier | Constructor and Description |
---|---|
protected |
JOSEObjectJSON(Payload payload)
Creates a new JOSE object with the specified payload.
|
Modifier and Type | Method and Description |
---|---|
Payload |
getPayload()
Returns the payload of this JOSE object.
|
static JOSEObjectJSON |
parse(Map<String,Object> jsonObject)
Parses a JOSE secured object from the specified JSON object
representation.
|
static JOSEObjectJSON |
parse(String json)
Parses a JOSE secured object from the specified JSON string.
|
abstract String |
serializeFlattened()
Serialises this JOSE object to a flattened JSON object string.
|
abstract String |
serializeGeneral()
Serialises this JOSE object to a general JOSE object string.
|
protected void |
setPayload(Payload payload)
Sets the payload of this JOSE object.
|
public static final String MIME_TYPE_JOSE_JSON
application/jose+json; charset=UTF-8
protected JOSEObjectJSON(Payload payload)
payload
- The payload, null
if not available (e.g. for
an encrypted JWE object).protected void setPayload(Payload payload)
payload
- The payload, null
if not available (e.g. for
an encrypted JWE object).public Payload getPayload()
null
if not available (for an encrypted
JWE object that hasn't been decrypted).public abstract String serializeGeneral()
IllegalStateException
- If the JOSE object is not in a state
that permits serialisation.public abstract String serializeFlattened()
See JWS flattened serialisation or JWE flattened serialisation.
IllegalStateException
- If the JOSE object is not in a state
that permits serialisation or there
is more than one JWS signature or JWE
recipient.public static JOSEObjectJSON parse(Map<String,Object> jsonObject) throws ParseException
jsonObject
- The JSON object to parse. Must not be
null
.JWSObjectJSON
or
JWEObjectJSON
.ParseException
- If the JSON object couldn't be parsed to a
valid JWS or JWE secured object.public static JOSEObjectJSON parse(String json) throws ParseException
json
- The JSON string to parse. Must not be null
.JWSObjectJSON
or
JWEObjectJSON
.ParseException
- If the string couldn't be parsed to a valid
JWS or JWE secured object.Copyright © 2021 Connect2id Ltd.. All rights reserved.