Class AbstractJsonJOSEObjectBuilder<A,B extends JsonJOSEObject<A>,C extends JOSEHeaderConfigurator<C>,D extends AbstractJsonJOSEObjectBuilder<A,B,C,D>>
- Type Parameters:
A- the payload typeB- the JSON JOSE object typeC- the JOSE header configurator typeD- the JSON JOSE object bulder type
- All Implemented Interfaces:
JsonJOSEObjectBuilder<A,B, C, D>
- Direct Known Subclasses:
GenericJsonJWEBuilder,GenericJsonJWSBuilder
Base JSON JOSE object builder implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.inverno.mod.security.jose.internal.converter.DataConversionServiceThe data conversion service.protected final JWKServiceThe JWK service.protected final com.fasterxml.jackson.databind.ObjectMapperThe object mapper.protected AThe payload.The protected JOSE header configurer.protected final TypeThe payload type.The unprotected JOSE header configurer. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractJsonJOSEObjectBuilder(com.fasterxml.jackson.databind.ObjectMapper mapper, io.inverno.mod.security.jose.internal.converter.DataConversionService dataConversionService, JWKService jwkService, Type type) Creates a JSON JOSE object builder. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidVerifies that the payload is valid.getPayloadEncoder(Function<A, reactor.core.publisher.Mono<String>> overridingPayloadEncoder, String overridingContentType, String cty) Returns the payload encoder to use to serialize the payload.Specifies the common protected and unprotected headers.Specifies the payload.Methods 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, build, build
-
Field Details
-
mapper
protected final com.fasterxml.jackson.databind.ObjectMapper mapperThe object mapper. -
dataConversionService
protected final io.inverno.mod.security.jose.internal.converter.DataConversionService dataConversionServiceThe data conversion service. -
jwkService
The JWK service. -
type
The payload type. -
protectedHeaderConfigurer
The protected JOSE header configurer. -
unprotectedHeaderConfigurer
The unprotected JOSE header configurer. -
payload
The payload.
-
-
Constructor Details
-
AbstractJsonJOSEObjectBuilder
public AbstractJsonJOSEObjectBuilder(com.fasterxml.jackson.databind.ObjectMapper mapper, io.inverno.mod.security.jose.internal.converter.DataConversionService dataConversionService, JWKService jwkService, Type type) Creates a JSON JOSE object builder.
- Parameters:
mapper- an object mapperdataConversionService- a data conversion servicejwkService- a JWK servicetype- the payload type
-
-
Method Details
-
headers
Description copied from interface:JsonJOSEObjectBuilderSpecifies the common protected and unprotected headers.
The payload is common and as a result it is recommended to specify the payload content type in the common headers.
- Specified by:
headersin interfaceJsonJOSEObjectBuilder<A,B extends JsonJOSEObject<A>, C extends JOSEHeaderConfigurator<C>, D extends AbstractJsonJOSEObjectBuilder<A, B, C, D>> - Parameters:
protectedHeaderConfigurer- the protected JOSE header configurerunprotectedHeaderConfigurer- the unprotected JOSE header configurer- Returns:
- this builder
-
payload
Description copied from interface:JsonJOSEObjectBuilderSpecifies the payload.
- Specified by:
payloadin interfaceJsonJOSEObjectBuilder<A,B extends JsonJOSEObject<A>, C extends JOSEHeaderConfigurator<C>, D extends AbstractJsonJOSEObjectBuilder<A, B, C, D>> - Parameters:
payload- the payload- Returns:
- this builder
-
checkPayload
Verifies that the payload is valid.
This basically checks that the payload is not null.
- Throws:
JOSEObjectBuildException- if the payload is invalidJOSEProcessingException- if there was a JOSE processing error
-
getPayloadEncoder
protected Function<A,reactor.core.publisher.Mono<String>> getPayloadEncoder(Function<A, reactor.core.publisher.Mono<String>> overridingPayloadEncoder, String overridingContentType, String cty) throws JOSEObjectBuildException, JOSEProcessingExceptionReturns the payload encoder to use to serialize the payload.
This method first considers the overriding payload encoder which is returned if present. Then the overriding content type is used if present to resolve the media type converter to use. Finally the payload content type defined in JOSE headers is considered to resolve the media type converter to use.
- Parameters:
overridingPayloadEncoder- the overriding payload encoderoverridingContentType- the overriding payload media typecty- the payload content type defined in JOSE headers- Returns:
- a payload encoder
- Throws:
JOSEObjectBuildException- if no payload encoder could have been resolvedJOSEProcessingException- if there was a JOSE processing error
-