Interface JsonJOSEObjectBuilder<A,B extends JsonJOSEObject<A>,C extends JOSEHeaderConfigurator<C>,D extends JsonJOSEObjectBuilder<A,B,C,D>>

Type Parameters:
A - the payload type
B - the JSON JOSE object type
C - the JOSE header configurator type
D - the JSON JOSE object builder type
All Known Subinterfaces:
JsonJWEBuilder<A,B,C>, JsonJWSBuilder<A,B,C>

public interface JsonJOSEObjectBuilder<A,B extends JsonJOSEObject<A>,C extends JOSEHeaderConfigurator<C>,D extends JsonJOSEObjectBuilder<A,B,C,D>>

A JSON JOSE object builder is used to build JSON JOSE objects that can be serialized to the JSON representation.

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

    Modifier and Type
    Method
    Description
    default Mono<B>
    Builds the JSON JOSE object.
    build(String contentType)
    Builds the JSON JOSE object using the specified payload media type.
    build(Function<A,Mono<String>> payloadEncoder)
    Builds the JSON JOSE object using the specified payload encoder.
    headers(Consumer<C> protectedHeaderConfigurer, Consumer<C> unprotectedHeaderConfigurer)
    Specifies the common protected and unprotected headers.
    payload(A payload)
    Specifies the payload.
  • Method Details

    • headers

      D headers(Consumer<C> protectedHeaderConfigurer, Consumer<C> unprotectedHeaderConfigurer)

      Specifies the common protected and unprotected headers.

      The payload is common and as a result it is recommended to specify the payload content type in the common headers.

      Parameters:
      protectedHeaderConfigurer - the protected JOSE header configurer
      unprotectedHeaderConfigurer - the unprotected JOSE header configurer
      Returns:
      this builder
    • payload

      D payload(A payload)

      Specifies the payload.

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

      Builds the JSON JOSE object.

      The builder will rely on the payload media type specified in the JOSE headers 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 JSON JOSE object publisher
      Throws:
      JOSEObjectBuildException - if there was an error building the JSON JOSE object
      JOSEProcessingException - if there was a JOSE processing error
    • build

      Builds the JSON 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 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 build method build(java.util.function.Function) to provide a custom payload encoder.

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

      Builds the JSON 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 headers.

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