Package com.nimbusds.jose
Class PlainHeader.Builder
java.lang.Object
com.nimbusds.jose.PlainHeader.Builder
- Enclosing class:
- PlainHeader
Builder for constructing unsecured (plain) headers.
Example usage:
PlainHeader header = new PlainHeader.Builder().
contentType("text/plain").
customParam("exp", new Date().getTime()).
build();
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder()Creates a new unsecured (plain) header builder.Builder(PlainHeader plainHeader) Creates a new unsecured (plain) header builder with the parameters from the specified header. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a new unsecured (plain) header.contentType(String cty) Sets the content type (cty) parameter.criticalParams(Set<String> crit) Sets the critical header parameters (crit) parameter.customParam(String name, Object value) Sets a custom (non-registered) parameter.customParams(Map<String, Object> customParameters) Sets the custom (non-registered) parameters.parsedBase64URL(Base64URL base64URL) Sets the parsed Base64URL.type(JOSEObjectType typ) Sets the type (typ) parameter.
-
Constructor Details
-
Builder
public Builder()Creates a new unsecured (plain) header builder. -
Builder
Creates a new unsecured (plain) header builder with the parameters from the specified header.- Parameters:
plainHeader- The unsecured header to use. Must not benull.
-
-
Method Details
-
type
Sets the type (typ) parameter.- Parameters:
typ- The type parameter,nullif not specified.- Returns:
- This builder.
-
contentType
Sets the content type (cty) parameter.- Parameters:
cty- The content type parameter,nullif not specified.- Returns:
- This builder.
-
criticalParams
Sets the critical header parameters (crit) parameter.- Parameters:
crit- The names of the critical header parameters, empty set ornullif none.- Returns:
- This builder.
-
customParam
Sets a custom (non-registered) parameter.- Parameters:
name- The name of the custom parameter. Must not match a registered parameter name and must not benull.value- The value of the custom parameter, should map to a valid JSON entity,nullif not specified.- Returns:
- This builder.
- Throws:
IllegalArgumentException- If the specified parameter name matches a registered parameter name.
-
customParams
Sets the custom (non-registered) parameters. The values must be serialisable to a JSON entity, otherwise will be ignored.- Parameters:
customParameters- The custom parameters, empty map ornullif none.- Returns:
- This builder.
-
parsedBase64URL
Sets the parsed Base64URL.- Parameters:
base64URL- The parsed Base64URL,nullif the header is created from scratch.- Returns:
- This builder.
-
build
Builds a new unsecured (plain) header.- Returns:
- The unsecured header.
-