Interface JOSEObjectReader<A,B extends JOSEHeader,C extends JOSEObject<A,B>,D extends JOSEObjectReader<A,B,C,D>>

Type Parameters:
A - the payload type
B - the JOSE header type
C - the JOSE object type
D - the JOSE object reader type
All Known Subinterfaces:
JWEReader<A,B>, JWSReader<A,B>

public interface JOSEObjectReader<A,B extends JOSEHeader,C extends JOSEObject<A,B>,D extends JOSEObjectReader<A,B,C,D>>

A JOSE object reader is used to read single JOSE objects serialized in the compact representation.

JOSE objects can be serialized to compact representations as defined by RFC7515 Section 7.1 or RFC7516 Section 7.1.

Since:
1.5
Author:
Jeremy Kuhn
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    processedParameters(String... parameters)
    Specifies the JOSE header custom parameters processed by the application.
    default Mono<C>
    read(String compact)
    Reads the specified compact representation and returns the corresponding JOSE object.
    read(String compact, String contentType)
    Reads the specified compact representation using the specified payload media type and returns the corresponding JOSE object.
    read(String compact, Function<String,Mono<A>> payloadDecoder)
    Reads the specified compact representation using the specified payload decoder and returns the corresponding JOSE object.
  • Method Details

    • processedParameters

      D processedParameters(String... parameters)

      Specifies the JOSE header custom parameters processed by the application.

      These parameters are expected to be present in the JOSE header, they are not processed by the reader but by the application reading the JOSE object. This enables the reader to check that the critical parameters set defined in the JOSE header actually contains parameters that are understood and processed by either the reader or the application.

      Parameters:
      parameters - a list of parameters
      Returns:
      this reader
    • read

      Reads the specified compact representation and returns the corresponding JOSE object.

      The reader will rely on the payload media type specified in the JOSE header to determine how to deserialize the payload. The operation will fail if it is not able to determine the media type converter to use. Please consider other read methods read(java.lang.String, java.lang.String) and read(java.lang.String, java.util.function.Function) to explicitly specifies how the payload should be deserialized.

      Parameters:
      compact - a JOSE object compact representation
      Returns:
      a single JOSE object publisher
      Throws:
      JOSEObjectReadException - if there was an error reading the JOSE object
      JOSEObjectBuildException - if there was an error building the JOSE object
      JOSEProcessingException - if there was a JOSE processing error
    • read

      Reads 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 read(java.lang.String, java.util.function.Function) to provide a custom payload decoder.

      Parameters:
      compact - a JOSE object compact representation
      contentType - the expected payload media type
      Returns:
      a single JOSE object publisher
      Throws:
      JOSEObjectReadException - if there was an error reading the JOSE object
      JOSEObjectBuildException - if there was an error building the JOSE object
      JOSEProcessingException - if there was a JOSE processing error
    • read

      Reads 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.

      Parameters:
      compact - a JOSE object compact representation
      payloadDecoder - a payload decoder
      Returns:
      a single JOSE object publisher
      Throws:
      JOSEObjectReadException - if there was an error reading the JOSE object
      JOSEObjectBuildException - if there was an error building the JOSE object
      JOSEProcessingException - if there was a JOSE processing error