Class GenericJsonJWSBuilder<A>
- Type Parameters:
A- the payload type
- All Implemented Interfaces:
JsonJOSEObjectBuilder<A,,JsonJWS<A, JsonJWS.BuiltSignature<A>>, GenericJWSHeader, GenericJsonJWSBuilder<A>> JsonJWSBuilder<A,GenericJWSHeader, GenericJsonJWSBuilder<A>>
Generic JSON JWS builder implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classBuilt signature info for building and holding signature specific information. -
Field Summary
Fields inherited from class io.inverno.mod.security.jose.internal.AbstractJsonJOSEObjectBuilder
dataConversionService, jwkService, mapper, payload, protectedHeaderConfigurer, type, unprotectedHeaderConfigurer -
Constructor Summary
ConstructorsConstructorDescriptionGenericJsonJWSBuilder(com.fasterxml.jackson.databind.ObjectMapper mapper, io.inverno.mod.security.jose.internal.converter.DataConversionService dataConversionService, JWKService jwkService, Type type) Creates a generic JSON JWS builder. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<JsonJWS<A,JsonJWS.BuiltSignature<A>>> Builds the JSON JOSE object using the specified payload media type.reactor.core.publisher.Mono<JsonJWS<A,JsonJWS.BuiltSignature<A>>> Builds the JSON JOSE object using the specified payload encoder.protected reactor.core.publisher.Mono<GenericJWSPayload<A>>buildJWSPayload(Function<A, reactor.core.publisher.Mono<String>> overridingPayloadEncoder, String overridingContentType, String cty, Boolean b64) Builds the JSON JWS.signature(Consumer<GenericJWSHeader> protectedHeaderConfigurer, Consumer<GenericJWSHeader> unprotectedHeaderConfigurer, org.reactivestreams.Publisher<? extends JWK> keys) Specifies a signature to add to the resulting JSON JWS object using the specified keys.Methods inherited from class io.inverno.mod.security.jose.internal.AbstractJsonJOSEObjectBuilder
checkPayload, getPayloadEncoder, headers, payloadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.inverno.mod.security.jose.JsonJOSEObjectBuilder
build, headers, payloadMethods inherited from interface io.inverno.mod.security.jose.jws.JsonJWSBuilder
signature
-
Constructor Details
-
GenericJsonJWSBuilder
public GenericJsonJWSBuilder(com.fasterxml.jackson.databind.ObjectMapper mapper, io.inverno.mod.security.jose.internal.converter.DataConversionService dataConversionService, JWKService jwkService, Type type) Creates a generic JSON JWS builder.
- Parameters:
mapper- an object mapperdataConversionService- a data conversion servicejwkService- a JWK servicetype- the payload type
-
-
Method Details
-
signature
public GenericJsonJWSBuilder<A> signature(Consumer<GenericJWSHeader> protectedHeaderConfigurer, Consumer<GenericJWSHeader> unprotectedHeaderConfigurer, org.reactivestreams.Publisher<? extends JWK> keys) Description copied from interface:JsonJWSBuilderSpecifies a signature to add to the resulting JSON JWS object using the specified keys.
The builder will use the specified keys to sign the payload, the first succeeding key will be retained and remaining keys will be ignored. It will fail if no suitable key have been specified or if they are not consistent with the JWS JOSE header resulting from the merge of the protected and unprotected headers.
- Specified by:
signaturein interfaceJsonJWSBuilder<A,GenericJWSHeader, GenericJsonJWSBuilder<A>> - Parameters:
protectedHeaderConfigurer- the protected JWE JOSE header configurerunprotectedHeaderConfigurer- the unprotected JWE JOSE header configurerkeys- the keys to consider to sign the payload- Returns:
- this builder
-
build
public reactor.core.publisher.Mono<JsonJWS<A,JsonJWS.BuiltSignature<A>>> build(String contentType) throws JWSBuildException, JOSEObjectBuildException, JOSEProcessingException Description copied from interface:JsonJOSEObjectBuilderBuilds the JSON JOSE object using the specified payload media type.
The builder will use the specified media type to determine the converter to use to serialize the payload and ignore the content type specified in the JOSE headers. The operation will fail if there is no media type converters defined for that particular media type. Media types converters are provided when building the JOSE module. Please consider build method
JsonJOSEObjectBuilder.build(java.util.function.Function)to provide a custom payload encoder.- Specified by:
buildin interfaceJsonJOSEObjectBuilder<A,JsonJWS<A, JsonJWS.BuiltSignature<A>>, GenericJWSHeader, GenericJsonJWSBuilder<A>> - Parameters:
contentType- the payload media type- Returns:
- a single JSON JOSE object publisher
- Throws:
JOSEObjectBuildException- if there was an error building the JSON JOSE objectJOSEProcessingException- if there was a JOSE processing errorJWSBuildException
-
build
public reactor.core.publisher.Mono<JsonJWS<A,JsonJWS.BuiltSignature<A>>> build(Function<A, reactor.core.publisher.Mono<String>> payloadEncoder) throws JWSBuildException, JOSEObjectBuildException, JOSEProcessingExceptionDescription copied from interface:JsonJOSEObjectBuilderBuilds the JSON JOSE object using the specified payload encoder.
The builder will use the specified payload encoder to serialize the payload and ignore the content type specified in the JOSE headers.
- Specified by:
buildin interfaceJsonJOSEObjectBuilder<A,JsonJWS<A, JsonJWS.BuiltSignature<A>>, GenericJWSHeader, GenericJsonJWSBuilder<A>> - Parameters:
payloadEncoder- a payload encoder- Returns:
- a single JSON JOSE object publisher
- Throws:
JOSEObjectBuildException- if there was an error building the JSON JOSE objectJOSEProcessingException- if there was a JOSE processing errorJWSBuildException
-
buildJWSPayload
protected reactor.core.publisher.Mono<GenericJWSPayload<A>> buildJWSPayload(Function<A, reactor.core.publisher.Mono<String>> overridingPayloadEncoder, String overridingContentType, String cty, Boolean b64) throws JWSBuildException, JOSEObjectBuildException, JOSEProcessingExceptionBuilds the JSON JWS.
- Parameters:
overridingPayloadEncoder- an overriding payload encoderoverridingContentType- an overriding payload content typecty- common JSON JWS payload content typeb64- common JSON JWS b64 parameter- Returns:
- a single JSON JWS publisher
- Throws:
JWSBuildException- if there was an error building the JSON JWSJOSEObjectBuildException- if there was an error building the JSON JWSJOSEProcessingException- if there was a JOSE processing error
-