Class GenericJWSBuilder<A>
- Type Parameters:
A- the payload type
- All Implemented Interfaces:
JOSEObjectBuilder<A,,JWSHeader, JWS<A>, GenericJWSHeader, GenericJWSBuilder<A>> JWSBuilder<A,GenericJWSHeader, GenericJWSBuilder<A>>
- Direct Known Subclasses:
SignatureJWSBuilder
Generic JSON Web Signature builder implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
FieldsFields inherited from class io.inverno.mod.security.jose.internal.AbstractJOSEObjectBuilder
dataConversionService, jwkService, keys, mapper, payload, type -
Constructor Summary
ConstructorsConstructorDescriptionGenericJWSBuilder(com.fasterxml.jackson.databind.ObjectMapper mapper, io.inverno.mod.security.jose.internal.converter.DataConversionService dataConversionService, JWKService jwkService, Type type, org.reactivestreams.Publisher<? extends JWK> keys) Creates a generic JWS builder. -
Method Summary
Modifier and TypeMethodDescriptionBuilds the JOSE object using the specified payload media type.Builds the JOSE object using the specified payload encoder.protected GenericJWSHeaderBuilds the JWS header.protected reactor.core.publisher.Mono<GenericJWSPayload<A>>buildJWSPayload(Function<A, reactor.core.publisher.Mono<String>> overridingPayloadEncoder, String overridingContentType, GenericJWSHeader jwsHeader) Builds the JWS payload.header(Consumer<GenericJWSHeader> configurer) Specifies the JOSE header.Methods inherited from class io.inverno.mod.security.jose.internal.AbstractJOSEObjectBuilder
checkHeader, checkPayload, getKeys, getPayloadEncoder, getProcessedParameters, 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.JOSEObjectBuilder
build, payload
-
Field Details
-
headerConfigurer
The JWS header configurer.
-
-
Constructor Details
-
GenericJWSBuilder
public GenericJWSBuilder(com.fasterxml.jackson.databind.ObjectMapper mapper, io.inverno.mod.security.jose.internal.converter.DataConversionService dataConversionService, JWKService jwkService, Type type, org.reactivestreams.Publisher<? extends JWK> keys) Creates a generic JWS builder.
- Parameters:
mapper- an object mapperdataConversionService- a data conversion servicejwkService- a JWK servicetype- the payload typekeys- the keys to consider to sign the JWS
-
-
Method Details
-
header
Description copied from interface:JOSEObjectBuilderSpecifies the JOSE header.
- Specified by:
headerin interfaceJOSEObjectBuilder<A,JWSHeader, JWS<A>, GenericJWSHeader, GenericJWSBuilder<A>> - Parameters:
configurer- a JOSE header configurer- Returns:
- this builder
-
build
public reactor.core.publisher.Mono<JWS<A>> build(String contentType) throws JWSBuildException, JOSEObjectBuildException, JOSEProcessingException Description copied from interface:JOSEObjectBuilderBuilds the 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 header. 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
JOSEObjectBuilder.build(java.util.function.Function)to provide a custom payload encoder.- Specified by:
buildin interfaceJOSEObjectBuilder<A,JWSHeader, JWS<A>, GenericJWSHeader, GenericJWSBuilder<A>> - Parameters:
contentType- the payload media type- Returns:
- a single JOSE object publisher
- Throws:
JOSEObjectBuildException- if there was an error building the JOSE objectJOSEProcessingException- if there was a JOSE processing errorJWSBuildException
-
build
public reactor.core.publisher.Mono<JWS<A>> build(Function<A, reactor.core.publisher.Mono<String>> payloadEncoder) throws JWSBuildException, JOSEObjectBuildException, JOSEProcessingExceptionDescription copied from interface:JOSEObjectBuilderBuilds the 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 header.
- Specified by:
buildin interfaceJOSEObjectBuilder<A,JWSHeader, JWS<A>, GenericJWSHeader, GenericJWSBuilder<A>> - Parameters:
payloadEncoder- a payload encoder- Returns:
- a single JOSE object publisher
- Throws:
JOSEObjectBuildException- if there was an error building the JOSE objectJOSEProcessingException- if there was a JOSE processing errorJWSBuildException
-
buildJWSHeader
protected GenericJWSHeader buildJWSHeader() throws JWSBuildException, JOSEObjectBuildException, JOSEProcessingExceptionBuilds the JWS header.
- Returns:
- the JWS header
- Throws:
JWSBuildException- if there was an error building the JWS headerJOSEObjectBuildException- if there was an error building the JWS headerJOSEProcessingException- if there was a JOSE processing error
-
buildJWSPayload
protected reactor.core.publisher.Mono<GenericJWSPayload<A>> buildJWSPayload(Function<A, reactor.core.publisher.Mono<String>> overridingPayloadEncoder, String overridingContentType, GenericJWSHeader jwsHeader) throws JWSBuildException, JOSEObjectBuildException, JOSEProcessingExceptionBuilds the JWS payload.
- Parameters:
overridingPayloadEncoder- an overriding payload encoderoverridingContentType- an overriding payload content typejwsHeader- the JWS header- Returns:
- a single JWS payload publisher
- Throws:
JWSBuildException- if there was an error building the JWS payloadJOSEObjectBuildException- if there was an error building the JWS payloadJOSEProcessingException- if there was a JOSE processing error
-