public class PlainHeader extends Header implements ReadOnlyPlainHeader
Supports all registered header
parameters of the plain specification:
"none").
The header may also carry custom parameters;
these will be serialised and parsed along the registered ones.
Example:
{
"alg" : "none"
}
| Constructor and Description |
|---|
PlainHeader()
Creates a new plain header with algorithm
none. |
| Modifier and Type | Method and Description |
|---|---|
Algorithm |
getAlgorithm()
Gets the algorithm (
alg) parameter. |
java.util.Set<java.lang.String> |
getIncludedParameters()
Gets the names of all included parameters (registered and custom) in
the header instance.
|
static java.util.Set<java.lang.String> |
getRegisteredParameterNames()
Gets the registered parameter names for plain headers.
|
static PlainHeader |
parse(Base64URL base64URL)
Parses a plain header from the specified Base64URL.
|
static PlainHeader |
parse(net.minidev.json.JSONObject json)
Parses a plain header from the specified JSON object.
|
static PlainHeader |
parse(java.lang.String s)
Parses a plain header from the specified JSON string.
|
void |
setCustomParameter(java.lang.String name,
java.lang.Object value)
Sets a custom (non-registered) parameter.
|
getContentType, getCriticalHeaders, getCustomParameter, getCustomParameters, getType, parseAlgorithm, setContentType, setCriticalHeaders, setCustomParameters, setParsedBase64URL, setType, toBase64URL, toJSONObject, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetContentType, getCriticalHeaders, getCustomParameter, getCustomParameters, getType, toBase64URL, toJSONObject, toStringpublic PlainHeader()
none.public static java.util.Set<java.lang.String> getRegisteredParameterNames()
public Algorithm getAlgorithm()
ReadOnlyPlainHeaderalg) parameter.getAlgorithm in interface ReadOnlyHeadergetAlgorithm in interface ReadOnlyPlainHeaderAlgorithm.NONE.public void setCustomParameter(java.lang.String name, java.lang.Object value)
HeadersetCustomParameter in class Headername - The name of the custom parameter. Must not match a
registered 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.java.lang.IllegalArgumentException - If the specified parameter name
matches a registered parameter
name.public java.util.Set<java.lang.String> getIncludedParameters()
ReadOnlyHeadergetIncludedParameters in interface ReadOnlyHeaderpublic static PlainHeader parse(net.minidev.json.JSONObject json) throws java.text.ParseException
json - The JSON object to parse. Must not be null.java.text.ParseException - If the specified JSON object doesn't
represent a valid plain header.public static PlainHeader parse(java.lang.String s) throws java.text.ParseException
s - The JSON string to parse. Must not be null.java.text.ParseException - If the specified JSON string doesn't
represent a valid plain header.public static PlainHeader parse(Base64URL base64URL) throws java.text.ParseException
base64URL - The Base64URL to parse. Must not be null.java.text.ParseException - If the specified Base64URL doesn't represent
a valid plain header.Copyright © 2014 Connect2id Ltd.. All Rights Reserved.