|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nimbusds.jose.Header com.nimbusds.jose.CommonSEHeader com.nimbusds.jose.JWSHeader
public class JWSHeader
JSON Web Signature (JWS) header.
Supports all reserved header parameters
of the JWS specification:
The header may also carry custom parameters
;
these will be serialised and parsed along the reserved ones.
Example header of a JSON Web Signature (JWS) object using the
HMAC SHA-256 algorithm
:
{ "alg" : "HS256" }
Field Summary |
---|
Fields inherited from class com.nimbusds.jose.Header |
---|
alg |
Constructor Summary | |
---|---|
JWSHeader(JWSAlgorithm alg)
Creates a new JSON Web Signature (JWS) header. |
Method Summary | |
---|---|
JWSAlgorithm |
getAlgorithm()
Gets the algorithm ( alg ) parameter. |
Set<String> |
getIncludedParameters()
Gets the names of all included parameters (reserved and custom) in the header instance. |
static Set<String> |
getReservedParameterNames()
Gets the reserved parameter names for JWS headers. |
static JWSHeader |
parse(Base64URL base64URL)
Parses a JWS header from the specified Base64URL. |
static JWSHeader |
parse(net.minidev.json.JSONObject json)
Parses a JWS header from the specified JSON object. |
static JWSHeader |
parse(String s)
Parses a JWS header from the specified JSON string. |
void |
setCustomParameter(String name,
Object value)
Sets a custom (non-reserved) parameter. |
Methods inherited from class com.nimbusds.jose.CommonSEHeader |
---|
getJWK, getJWKURL, getKeyID, getX509CertChain, getX509CertThumbprint, getX509CertURL, parseX509CertChain, setJWK, setJWKURL, setKeyID, setX509CertChain, setX509CertThumbprint, setX509CertURL, toJSONObject |
Methods inherited from class com.nimbusds.jose.Header |
---|
getContentType, getCriticalHeaders, getCustomParameter, getCustomParameters, getType, parseAlgorithm, setContentType, setCriticalHeaders, setCustomParameters, setParsedBase64URL, setType, toBase64URL, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.nimbusds.jose.ReadOnlyCommonSEHeader |
---|
getJWK, getJWKURL, getKeyID, getX509CertChain, getX509CertThumbprint, getX509CertURL |
Methods inherited from interface com.nimbusds.jose.ReadOnlyHeader |
---|
getContentType, getCriticalHeaders, getCustomParameter, getCustomParameters, getType, toBase64URL, toJSONObject, toString |
Constructor Detail |
---|
public JWSHeader(JWSAlgorithm alg)
alg
- The JWS algorithm. Must not be null
.Method Detail |
---|
public static Set<String> getReservedParameterNames()
public JWSAlgorithm getAlgorithm()
ReadOnlyJWSHeader
alg
) parameter.
getAlgorithm
in interface ReadOnlyHeader
getAlgorithm
in interface ReadOnlyJWSHeader
public void setCustomParameter(String name, Object value)
Header
setCustomParameter
in class Header
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.
IllegalArgumentException
- If the specified parameter name
matches a reserved parameter name.public Set<String> getIncludedParameters()
ReadOnlyHeader
getIncludedParameters
in interface ReadOnlyHeader
public static JWSHeader parse(net.minidev.json.JSONObject json) throws ParseException
json
- The JSON object to parse. Must not be null
.
ParseException
- If the specified JSON object doesn't
represent a valid JWS header.public static JWSHeader parse(String s) throws ParseException
s
- The JSON string to parse. Must not be null
.
ParseException
- If the specified JSON object string doesn't
represent a valid JWS header.public static JWSHeader parse(Base64URL base64URL) throws ParseException
base64URL
- The Base64URL to parse. Must not be null
.
ParseException
- If the specified Base64URL doesn't represent a
valid JWS header.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |