@Immutable public final class PlainHeader extends Header
alg=none
) JOSE header. This class is immutable.
Supports all registered header
parameters
of the unsecured JOSE object specification:
"none"
).
The header may also carry custom parameters
;
these will be serialised and parsed along the registered ones.
Example:
{ "alg" : "none" }
Modifier and Type | Class and Description |
---|---|
static class |
PlainHeader.Builder
Builder for constructing unsecured (plain) headers.
|
Constructor and Description |
---|
PlainHeader()
Creates a new minimal unsecured (plain) header with algorithm
none . |
PlainHeader(JOSEObjectType typ,
String cty,
Set<String> crit,
Map<String,Object> customParams,
Base64URL parsedBase64URL)
Creates a new unsecured (plain) header with algorithm
none . |
PlainHeader(PlainHeader plainHeader)
Deep copy constructor.
|
Modifier and Type | Method and Description |
---|---|
Algorithm |
getAlgorithm()
Gets the algorithm (
alg ) parameter. |
static Set<String> |
getRegisteredParameterNames()
Gets the registered parameter names for unsecured headers.
|
static PlainHeader |
parse(Base64URL base64URL)
Parses an unsecured header from the specified Base64URL.
|
static PlainHeader |
parse(net.minidev.json.JSONObject jsonObject)
Parses an unsecured header from the specified JSON object.
|
static PlainHeader |
parse(net.minidev.json.JSONObject jsonObject,
Base64URL parsedBase64URL)
Parses an unsecured header from the specified JSON object.
|
static PlainHeader |
parse(String jsonString)
Parses an unsecured header from the specified JSON string.
|
static PlainHeader |
parse(String jsonString,
Base64URL parsedBase64URL)
Parses an unsecured header from the specified JSON string.
|
getContentType, getCriticalParams, getCustomParam, getCustomParams, getIncludedParams, getParsedBase64URL, getType, parseAlgorithm, toBase64URL, toJSONObject, toString
public PlainHeader()
none
.public PlainHeader(JOSEObjectType typ, String cty, Set<String> crit, Map<String,Object> customParams, Base64URL parsedBase64URL)
none
.typ
- The type (typ
) parameter,
null
if not specified.cty
- The content type (cty
) parameter,
null
if not specified.crit
- The names of the critical header
(crit
) parameters, empty set or
null
if none.customParams
- The custom parameters, empty map or
null
if none.parsedBase64URL
- The parsed Base64URL, null
if the
header is created from scratch.public PlainHeader(PlainHeader plainHeader)
plainHeader
- The unsecured header to copy. Must not be
null
.public static Set<String> getRegisteredParameterNames()
public Algorithm getAlgorithm()
alg
) parameter.getAlgorithm
in class Header
Algorithm.NONE
.public static PlainHeader parse(net.minidev.json.JSONObject jsonObject) throws ParseException
jsonObject
- The JSON object to parse. Must not be null
.ParseException
- If the specified JSON object doesn't
represent a valid unsecured header.public static PlainHeader parse(net.minidev.json.JSONObject jsonObject, Base64URL parsedBase64URL) throws ParseException
jsonObject
- The JSON object to parse. Must not be
null
.parsedBase64URL
- The original parsed Base64URL, null
if not applicable.ParseException
- If the specified JSON object doesn't
represent a valid unsecured header.public static PlainHeader parse(String jsonString) throws ParseException
jsonString
- The JSON string to parse. Must not be
null
.ParseException
- If the specified JSON string doesn't
represent a valid unsecured header.public static PlainHeader parse(String jsonString, Base64URL parsedBase64URL) throws ParseException
jsonString
- The JSON string to parse. Must not be
null
.parsedBase64URL
- The original parsed Base64URL, null
if not applicable.ParseException
- If the specified JSON string doesn't
represent a valid unsecured header.public static PlainHeader parse(Base64URL base64URL) throws ParseException
base64URL
- The Base64URL to parse. Must not be null
.ParseException
- If the specified Base64URL doesn't represent
a valid unsecured header.Copyright © 2015 Connect2id Ltd.. All Rights Reserved.