Package com.nimbusds.jose
Class UnprotectedHeader
- java.lang.Object
-
- com.nimbusds.jose.UnprotectedHeader
-
@Immutable public final class UnprotectedHeader extends Object
JSON Web Signature (JWS) or JSON Web Encryption (JWE) unprotected header (in a JSON serialisation). This class is immutable.- Version:
- 2021-10-05
- Author:
- Alexander Martynov, Vladimir Dzhuvinov
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UnprotectedHeader.Builder
Builder for constructing an unprotected JWS or JWE header.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
getIncludedParams()
Gets the names of the included parameters in this unprotected header.String
getKeyID()
Gets the key ID (kid
) parameter.Object
getParam(String name)
Gets a parameter.static UnprotectedHeader
parse(Map<String,Object> jsonObject)
Parses an unprotected header from the specified JSON object.Map<String,Object>
toJSONObject()
Returns a JSON object representation of this unprotected header.
-
-
-
Method Detail
-
getKeyID
public String getKeyID()
Gets the key ID (kid
) parameter.- Returns:
- The key ID parameter,
null
if not specified.
-
getParam
public Object getParam(String name)
Gets a parameter.- Parameters:
name
- The name of the parameter. Must not benull
.- Returns:
- The parameter,
null
if not specified.
-
getIncludedParams
public Set<String> getIncludedParams()
Gets the names of the included parameters in this unprotected header.- Returns:
- The included parameters.
-
toJSONObject
public Map<String,Object> toJSONObject()
Returns a JSON object representation of this unprotected header.- Returns:
- The JSON object, empty if no parameters are specified.
-
parse
public static UnprotectedHeader parse(Map<String,Object> jsonObject) throws ParseException
Parses an unprotected header from the specified JSON object.- Parameters:
jsonObject
- The JSON object,null
if not specified.- Returns:
- The unprotected header or
null
. - Throws:
ParseException
- If the JSON object couldn't be parsed to a valid unprotected header.
-
-