Interface JOSEObjectBuilder<A,B extends JOSEHeader,C extends JOSEObject<A,B>,D extends JOSEHeaderConfigurator<D>,E extends JOSEObjectBuilder<A,B,C,D,E>>

Type Parameters:
A - the payload type
B - the JOSE header type
C - the JOSE object type
D - the JOSE header configurator type
E - the JOSE object builder type
All Known Subinterfaces:
JWEBuilder<A,B,C>, JWSBuilder<A,B,C>

public interface JOSEObjectBuilder<A,B extends JOSEHeader,C extends JOSEObject<A,B>,D extends JOSEHeaderConfigurator<D>,E extends JOSEObjectBuilder<A,B,C,D,E>>

A JOSE object builder is used to build single JOSE objects.

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

    Modifier and Type
    Method
    Description
    default Mono<C>
    Builds the JOSE object.
    build(String contentType)
    Builds the JOSE object using the specified payload media type.
    build(Function<A,Mono<String>> payloadEncoder)
    Builds the JOSE object using the specified payload encoder.
    header(Consumer<D> configurer)
    Specifies the JOSE header.
    payload(A payload)
    Specifies the JOSE object payload.
  • Method Details

    • header

      E header(Consumer<D> configurer)

      Specifies the JOSE header.

      Parameters:
      configurer - a JOSE header configurer
      Returns:
      this builder
    • payload

      E payload(A payload)

      Specifies the JOSE object payload.

      Parameters:
      payload - a payload
      Returns:
      this builder
    • build

      Builds the JOSE object.

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

      Returns:
      a single JOSE object publisher
      Throws:
      JOSEObjectBuildException - if there was an error building the JOSE object
      JOSEProcessingException - if there was a JOSE processing error
    • build

      Builds the JOSE object using the specified payload media type.

      The builder will use the specified media type to determine the converter to use to serialize 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 build method build(java.util.function.Function) to provide a custom payload encoder.

      Parameters:
      contentType - the payload media type
      Returns:
      a single JOSE object publisher
      Throws:
      JOSEObjectBuildException - if there was an error building the JOSE object
      JOSEProcessingException - if there was a JOSE processing error
    • build

      Builds the JOSE object using the specified payload encoder.

      The builder will use the specified payload encoder to serialize the payload and ignore the content type specified in the JOSE header.

      Parameters:
      payloadEncoder - a payload encoder
      Returns:
      a single JOSE object publisher
      Throws:
      JOSEObjectBuildException - if there was an error building the JOSE object
      JOSEProcessingException - if there was a JOSE processing error