Class GenericJWSReader<A>
- Type Parameters:
A- the payload type
- All Implemented Interfaces:
JOSEObjectReader<A,,JWSHeader, JWS<A>, GenericJWSReader<A>> JWSReader<A,GenericJWSReader<A>>
- Direct Known Subclasses:
SignatureJWSReader
Generic JSON Web Signature compact reader implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
Fields inherited from class io.inverno.mod.security.jose.internal.AbstractJOSEObjectReader
applicationProcessedParameters, dataConversionService, jwkService, keys, mapper, type -
Constructor Summary
ConstructorsConstructorDescriptionGenericJWSReader(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 reader. -
Method Summary
Modifier and TypeMethodDescriptionReads the specified compact representation using the specified payload media type and returns the corresponding JOSE object.Reads the specified compact representation using the specified payload decoder and returns the corresponding JOSE object.protected GenericJWSHeaderreadJWSHeader(String encodedHeader) Reads the JWS header.protected reactor.core.publisher.Mono<GenericJWSPayload<A>>readJWSPayload(String encodedPayload, Function<String, reactor.core.publisher.Mono<A>> overridingPayloadDecoder, String overridingContentType, GenericJWSHeader jwsHeader) Reads the JWS payload.Methods inherited from class io.inverno.mod.security.jose.internal.AbstractJOSEObjectReader
checkCriticalParameters, checkHeader, getKeys, getPayloadDecoder, getProcessedParameters, 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.JOSEObjectReader
processedParameters, read
-
Constructor Details
-
GenericJWSReader
public GenericJWSReader(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 reader.
- Parameters:
mapper- an object mapperdataConversionService- a data conversion servicejwkService- a JWK servicetype- the payload typekeys- the keys to consider to verify the JWS
-
-
Method Details
-
read
public reactor.core.publisher.Mono<JWS<A>> read(String compact, String contentType) throws JWSReadException, JWSBuildException, JOSEObjectReadException, JOSEObjectBuildException, JOSEProcessingException Description copied from interface:JOSEObjectReaderReads the specified compact representation using the specified payload media type and returns the corresponding 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 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 read method
JOSEObjectReader.read(java.lang.String, java.util.function.Function)to provide a custom payload decoder.- Specified by:
readin interfaceJOSEObjectReader<A,JWSHeader, JWS<A>, GenericJWSReader<A>> - Parameters:
compact- a JOSE object compact representationcontentType- the expected payload media type- Returns:
- a single JOSE object publisher
- Throws:
JOSEObjectReadException- if there was an error reading the JOSE objectJOSEObjectBuildException- if there was an error building the JOSE objectJOSEProcessingException- if there was a JOSE processing errorJWSReadExceptionJWSBuildException
-
read
public reactor.core.publisher.Mono<JWS<A>> read(String compact, Function<String, reactor.core.publisher.Mono<A>> payloadDecoder) throws JWSReadException, JWSBuildException, JOSEObjectReadException, JOSEObjectBuildException, JOSEProcessingExceptionDescription copied from interface:JOSEObjectReaderReads the specified compact representation using the specified payload decoder and returns the corresponding JOSE object.
The reader will use the specified payload decoder to deserialize the payload and ignore the content type specified in the JOSE header.
- Specified by:
readin interfaceJOSEObjectReader<A,JWSHeader, JWS<A>, GenericJWSReader<A>> - Parameters:
compact- a JOSE object compact representationpayloadDecoder- a payload decoder- Returns:
- a single JOSE object publisher
- Throws:
JOSEObjectReadException- if there was an error reading the JOSE objectJOSEObjectBuildException- if there was an error building the JOSE objectJOSEProcessingException- if there was a JOSE processing errorJWSReadExceptionJWSBuildException
-
readJWSHeader
protected GenericJWSHeader readJWSHeader(String encodedHeader) throws JWSReadException, JOSEObjectReadException, JOSEProcessingException Reads the JWS header.
- Parameters:
encodedHeader- the Base64URL encoded JWS header- Returns:
- the JWS header
- Throws:
JWSReadException- if there was an error reading the JWS headerJOSEObjectReadException- if there was an error reading the JWS headerJOSEProcessingException- 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, GenericJWSHeader jwsHeader) throws JWSReadException, JOSEObjectReadException, JOSEProcessingExceptionReads the JWS payload.
- Parameters:
encodedPayload- the Base64URL encoded payloadoverridingPayloadDecoder- an overriding payload decoderoverridingContentType- an overriding payload content typejwsHeader- the JWS header- Returns:
- a single JWS payload publisher
- Throws:
JWSReadException- if there was an error reading the JWS payloadJOSEObjectReadException- if there was an error reading the JWS payloadJOSEProcessingException- if there was a JOSE processing error
-