Class GenericJsonJWSReader<A>
- Type Parameters:
A- the expected payload type
- All Implemented Interfaces:
JsonJOSEObjectReader<A,,JsonJWS<A, JsonJWS.ReadSignature<A>>, GenericJsonJWSReader<A>> JsonJWSReader<A,GenericJsonJWSReader<A>>
Generic JSON JWS reader implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classRead signature info for holding signature specific information. -
Field Summary
Fields inherited from class io.inverno.mod.security.jose.internal.AbstractJsonJOSEObjectReader
applicationProcessedParameters, dataConversionService, jwkService, mapper, type -
Constructor Summary
ConstructorsConstructorDescriptionGenericJsonJWSReader(com.fasterxml.jackson.databind.ObjectMapper mapper, io.inverno.mod.security.jose.internal.converter.DataConversionService dataConversionService, JWKService jwkService, Type type) Creates a generic JSON JWS reader. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<JsonJWS<A,JsonJWS.ReadSignature<A>>> Reads the specified JSON representation using the specified payload media type and returns the corresponding JSON JOSE object.reactor.core.publisher.Mono<JsonJWS<A,JsonJWS.ReadSignature<A>>> Reads the specified JSON representation using the specified payload decoder and returns the corresponding JSON JOSE object.protected reactor.core.publisher.Mono<GenericJWSPayload<A>>readJWSPayload(String encodedPayload, Function<String, reactor.core.publisher.Mono<A>> overridingPayloadDecoder, String overridingContentType, String cty, Boolean b64) Reads the JSON JWS payload.protected GenericJsonJWSReader.SignatureInforeadJWSSignature(Object signatureElementValue) Reads a JSON JWS recipient.Methods inherited from class io.inverno.mod.security.jose.internal.AbstractJsonJOSEObjectReader
getPayloadDecoder, processedParametersMethods 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.JsonJOSEObjectReader
processedParameters, read
-
Constructor Details
-
GenericJsonJWSReader
public GenericJsonJWSReader(com.fasterxml.jackson.databind.ObjectMapper mapper, io.inverno.mod.security.jose.internal.converter.DataConversionService dataConversionService, JWKService jwkService, Type type) Creates a generic JSON JWS reader.
- Parameters:
mapper- an object mapperdataConversionService- a data conversion servicejwkService- a JWK servicetype- the expected payload type
-
-
Method Details
-
read
public reactor.core.publisher.Mono<JsonJWS<A,JsonJWS.ReadSignature<A>>> read(String json, String contentType) throws JWSReadException, JWSBuildException, JOSEObjectReadException, JOSEObjectBuildException, JOSEProcessingException Description copied from interface:JsonJOSEObjectReaderReads the specified JSON representation using the specified payload media type and returns the corresponding JSON JOSE object.
The reader will use the specified media type to determine the converter to use to deserialize 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 read method
JsonJOSEObjectReader.read(java.lang.String, java.util.function.Function)to provide a custom payload decoder.- Specified by:
readin interfaceJsonJOSEObjectReader<A,JsonJWS<A, JsonJWS.ReadSignature<A>>, GenericJsonJWSReader<A>> - Parameters:
json- a JSON JOSE object JSON representationcontentType- the expected payload media type- Returns:
- a single JSON JOSE object publisher
- Throws:
JOSEObjectReadException- if there was an error reading the JSON JOSE objectJOSEObjectBuildException- if there was an error building the JSON JOSE objectJOSEProcessingException- if there was a JOSE processing errorJWSReadExceptionJWSBuildException
-
read
public reactor.core.publisher.Mono<JsonJWS<A,JsonJWS.ReadSignature<A>>> read(String json, Function<String, reactor.core.publisher.Mono<A>> payloadDecoder) throws JWSReadException, JWSBuildException, JOSEObjectReadException, JOSEObjectBuildException, JOSEProcessingExceptionDescription copied from interface:JsonJOSEObjectReaderReads the specified JSON representation using the specified payload decoder and returns the corresponding JSON JOSE object.
The reader will use the specified payload decoder to deserialize the payload and ignore the content type specified in the JOSE headers.
- Specified by:
readin interfaceJsonJOSEObjectReader<A,JsonJWS<A, JsonJWS.ReadSignature<A>>, GenericJsonJWSReader<A>> - Parameters:
json- a JSON JOSE object JSON representationpayloadDecoder- a payload decoder- Returns:
- a single JSON JOSE object publisher
- Throws:
JOSEObjectReadException- if there was an error reading the JSON JOSE objectJOSEObjectBuildException- if there was an error building the JSON JOSE objectJOSEProcessingException- if there was a JOSE processing errorJWSReadExceptionJWSBuildException
-
readJWSSignature
protected GenericJsonJWSReader.SignatureInfo readJWSSignature(Object signatureElementValue) throws JWSReadException, JOSEObjectReadException, JOSEProcessingException Reads a JSON JWS recipient.
- Parameters:
signatureElementValue- the extracted JSON JWS signature element- Returns:
- a read recipient info
- Throws:
JWSReadException- if there was an error reading the JSON JWS signatureJOSEObjectReadException- if there was an error reading the JSON JWS signatureJOSEProcessingException- if there was a JOSE processing error
-
readJWSPayload
protected reactor.core.publisher.Mono<GenericJWSPayload<A>> readJWSPayload(String encodedPayload, Function<String, reactor.core.publisher.Mono<A>> overridingPayloadDecoder, String overridingContentType, String cty, Boolean b64) throws JWSReadException, JOSEObjectReadException, JOSEProcessingExceptionReads the JSON JWS payload.
- Parameters:
encodedPayload- the Base64URL encoded payloadoverridingPayloadDecoder- an overriding payload decoderoverridingContentType- an overriding payload content typecty- the common payload content typeb64- the comming b64 parameter- Returns:
- a singe JWS payload publisher
- Throws:
JWSReadException- if there was an error reading the JSON JWS payloadJOSEObjectReadException- if there was an error reading the JSON JWS payloadJOSEProcessingException- if there was a JOSE processing error
-