|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.nimbusds.jose.Header
public abstract class Header
The base abstract class for plaintext, JSON Web Signature (JWS) and JSON Web Encryption (JWE) headers.
The header may also carry custom parameters;
these will be serialised and parsed along the reserved ones.
| Field Summary | |
|---|---|
protected Algorithm |
alg
The algorithm ( alg) parameter. |
| Constructor Summary | |
|---|---|
protected |
Header(Algorithm alg)
Creates a new header with the specified algorithm ( alg)
parameter. |
| Method Summary | |
|---|---|
String |
getContentType()
Gets the content type ( cty) parameter. |
Object |
getCustomParameter(String name)
Gets a custom (non-reserved) parameter. |
Map<String,Object> |
getCustomParameters()
Gets the custom (non-reserved) parameters. |
JOSEObjectType |
getType()
Gets the type ( typ) parameter. |
static Header |
parse(net.minidev.json.JSONObject json)
Parses a PlainHeader, JWSHeader or JWEHeader
from the specified JSON object. |
static Algorithm |
parseAlgorithm(net.minidev.json.JSONObject json)
Parses an algorithm ( alg) parameter from the specified
header JSON object. |
void |
setContentType(String cty)
Sets the content type ( cty) parameter. |
protected void |
setCustomParameter(String name,
Object value)
Sets a custom (non-reserved) parameter. |
void |
setCustomParameters(Map<String,Object> customParameters)
Sets the custom (non-reserved) parameters. |
void |
setType(JOSEObjectType typ)
Sets the type ( typ) parameter. |
Base64URL |
toBase64URL()
Returns a Base64URL representation of the header. |
net.minidev.json.JSONObject |
toJSONObject()
Returns a JSON object representation of the header. |
String |
toString()
Returns a JSON string representation of this header. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.nimbusds.jose.ReadOnlyHeader |
|---|
getAlgorithm, getIncludedParameters |
| Field Detail |
|---|
protected final Algorithm alg
alg) parameter.
| Constructor Detail |
|---|
protected Header(Algorithm alg)
alg)
parameter.
alg - The algorithm parameter. Must not be null.| Method Detail |
|---|
public JOSEObjectType getType()
ReadOnlyHeadertyp) parameter.
getType in interface ReadOnlyHeadernull if not specified.public void setType(JOSEObjectType typ)
typ) parameter.
typ - The type parameter, null if not specified.public String getContentType()
ReadOnlyHeadercty) parameter.
getContentType in interface ReadOnlyHeadernull if not specified.public void setContentType(String cty)
cty) parameter.
cty - The content type parameter, null if not specified.public Object getCustomParameter(String name)
ReadOnlyHeader
getCustomParameter in interface ReadOnlyHeadername - The name of the custom parameter. Must not be
null.
null if not specified.
protected void setCustomParameter(String name,
Object value)
name - The name of the custom parameter. Must not match a
reserved parameter name and must not be null.value - The value of the custom parameter, should map to a valid
JSON entity, null if not specified.public Map<String,Object> getCustomParameters()
ReadOnlyHeader
getCustomParameters in interface ReadOnlyHeaderpublic void setCustomParameters(Map<String,Object> customParameters)
customParameters - The custom parameters, empty map or
null if none.public net.minidev.json.JSONObject toJSONObject()
ReadOnlyHeader
toJSONObject in interface ReadOnlyHeaderpublic String toString()
toString in class Objectpublic Base64URL toBase64URL()
ReadOnlyHeader
toBase64URL in interface ReadOnlyHeader
public static Algorithm parseAlgorithm(net.minidev.json.JSONObject json)
throws ParseException
alg) parameter from the specified
header JSON object. Intended for initial parsing of plain, JWS and
JWE headers.
The algorithm type (none, JWS or JWE) is determined by inspecting the algorithm name for "none" and the presence of an "enc" parameter.
json - The JSON object to parse. Must not be null.
Algorithm.NONE,
JWSAlgorithm or JWEAlgorithm.
ParseException - If the alg parameter couldn't be
parsed.
public static Header parse(net.minidev.json.JSONObject json)
throws ParseException
PlainHeader, JWSHeader or JWEHeader
from the specified JSON object.
json - The JSON object to parse. Must not be null.
ParseException - If the specified JSON object doesn't represent
a valid header.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||