Class GenericJsonJWEReader<A>
- Type Parameters:
A- the expected payload type
- All Implemented Interfaces:
JsonJOSEObjectReader<A,,JsonJWE<A, JsonJWE.ReadRecipient<A>>, GenericJsonJWEReader<A>> JsonJWEReader<A,GenericJsonJWEReader<A>>
Generic JSON JWE reader implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classRead recipient info for holding recipient specific information. -
Field Summary
Fields inherited from class io.inverno.mod.security.jose.internal.AbstractJsonJOSEObjectReader
applicationProcessedParameters, dataConversionService, jwkService, mapper, type -
Constructor Summary
ConstructorsConstructorDescriptionGenericJsonJWEReader(com.fasterxml.jackson.databind.ObjectMapper mapper, io.inverno.mod.security.jose.internal.converter.DataConversionService dataConversionService, JWKService jwkService, Type type, List<JWEZip> zips) Creates a generic JSON JWE reader. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<JsonJWE<A,JsonJWE.ReadRecipient<A>>> Reads the specified JSON representation using the specified payload media type and returns the corresponding JSON JOSE object.reactor.core.publisher.Mono<JsonJWE<A,JsonJWE.ReadRecipient<A>>> Reads the specified JSON representation using the specified payload decoder and returns the corresponding JSON JOSE object.protected GenericJsonJWEReader.RecipientInforeadJWERecipient(Object recipientElementValue, JsonJWEHeader protectedJWEHeader, JsonJWEHeader unprotectedJWEHeader) Reads a JSON JWE recipient.protected JsonJWEHeaderreadProtectedJWEHeader(String protectedValue) Reads the JSON JWE protected header.protected JsonJWEHeaderreadUnprotectedJWEHeader(Map<String, Object> unprotectedValue) Reads the JSON JWE unprotected header.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
-
GenericJsonJWEReader
public GenericJsonJWEReader(com.fasterxml.jackson.databind.ObjectMapper mapper, io.inverno.mod.security.jose.internal.converter.DataConversionService dataConversionService, JWKService jwkService, Type type, List<JWEZip> zips) Creates a generic JSON JWE reader.
- Parameters:
mapper- an object mapperdataConversionService- a data conversion servicejwkService- a JWK servicetype- the expected payload typezips- a list of supported JWE compression algorithms
-
-
Method Details
-
read
public reactor.core.publisher.Mono<JsonJWE<A,JsonJWE.ReadRecipient<A>>> read(String json, String contentType) throws JWEReadException, JWEBuildException, 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,JsonJWE<A, JsonJWE.ReadRecipient<A>>, GenericJsonJWEReader<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 errorJWEReadExceptionJWEBuildException
-
read
public reactor.core.publisher.Mono<JsonJWE<A,JsonJWE.ReadRecipient<A>>> read(String json, Function<String, reactor.core.publisher.Mono<A>> payloadDecoder) throws JWEReadException, JWEBuildException, 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,JsonJWE<A, JsonJWE.ReadRecipient<A>>, GenericJsonJWEReader<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 errorJWEReadExceptionJWEBuildException
-
readProtectedJWEHeader
protected JsonJWEHeader readProtectedJWEHeader(String protectedValue) throws JWEReadException, JOSEObjectReadException, JOSEProcessingException Reads the JSON JWE protected header.
- Parameters:
protectedValue- the Base64URL encoded protected JWE header- Returns:
- the protected JWE header
- Throws:
JWEReadException- if there was an error reading the protected JWE headerJOSEObjectReadException- if there was an error reading the protected JWE headerJOSEProcessingException- if there was a JOSE processing error
-
readUnprotectedJWEHeader
protected JsonJWEHeader readUnprotectedJWEHeader(Map<String, Object> unprotectedValue) throws JWEReadException, JOSEObjectReadException, JOSEProcessingExceptionReads the JSON JWE unprotected header.
- Parameters:
unprotectedValue- the unprotected JWE header as map- Returns:
- the unprotected JWE header
- Throws:
JWEReadException- if there was an error reading the unprotected JWE headerJOSEObjectReadException- if there was an error reading the unprotected JWE headerJOSEProcessingException- if there was a JOSE processing error
-
readJWERecipient
protected GenericJsonJWEReader.RecipientInfo readJWERecipient(Object recipientElementValue, JsonJWEHeader protectedJWEHeader, JsonJWEHeader unprotectedJWEHeader) throws JWEReadException, JOSEObjectReadException, JOSEProcessingException Reads a JSON JWE recipient.
- Parameters:
recipientElementValue- the extracted JSON JWE recipient elementprotectedJWEHeader- the JSON JWE protected headerunprotectedJWEHeader- the JSON JWE unprotected header- Returns:
- a read recipient info
- Throws:
JWEReadException- if there was an error reading the JSON JWE recipientJOSEObjectReadException- if there was an error reading the JSON JWE recipientJOSEProcessingException- if there was a JOSE processing error
-