Interface JOSEObjectService

All Known Subinterfaces:
JWEService, JWSService

public interface JOSEObjectService

A JOSE object service is a main entry point for creating and reading particular JOSE objects.

It allows to fluently create JOSE objects using JOSEObjectBuilder for compact serialization or JsonJOSEObjectBuilder for JSON serialization. It also exposes JOSEObjectReader and JsonJOSEObjectReader to read compact representation or JSON representation respectively.

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

    • builder

      <T> JOSEObjectBuilder<T,?,?,?,?> builder()

      Returns a new JOSE object builder.

      The returned builder will try to resolve the JWK to use to secure the JOSE object based on the JOSE header. It will fail if it wasn't able to find a suitable key.

      Type Parameters:
      T - the payload type
      Returns:
      a new JOSE object builder
    • builder

      <T> JOSEObjectBuilder<T,?,?,?,?> builder(Class<T> type)

      Returns a new JOSE object builder with the specified payload type.

      The returned builder will try to resolve the JWK to use to secure the JOSE object based on the JOSE header. It will fail if it wasn't able to find a suitable key.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JOSE object builder
    • builder

      <T> JOSEObjectBuilder<T,?,?,?,?> builder(Type type)

      Returns a new JOSE object builder with the specified payload type.

      The returned builder will try to resolve the JWK to use to secure the JOSE object based on the JOSE header. It will fail if it wasn't able to find a suitable key.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JOSE object builder
    • builder

      <T> JOSEObjectBuilder<T,?,?,?,?> builder(Publisher<? extends JWK> keys)

      Returns a new JOSE object builder using the specified keys.

      The returned builder will use the specified keys to secure the JOSE object, the first succeeding key will be retained and remaining keys will be ignored. It will fail if no suitable key have been specified or if they are not consistent with the JOSE header.

      Type Parameters:
      T - the payload type
      Parameters:
      keys - the keys to consider to secure the JOSE object
      Returns:
      a new JOSE object builder
    • builder

      <T> JOSEObjectBuilder<T,?,?,?,?> builder(Class<T> type, Publisher<? extends JWK> keys)

      Returns a new JOSE object builder with the specified payload type and using the specified keys.

      The returned builder will use the specified keys to secure the JOSE object, the first succeeding key will be retained and remaining keys will be ignored. It will fail if no suitable key have been specified or if they are not consistent with the JOSE header.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      keys - the keys to consider to secure the JOSE object
      Returns:
      a new JOSE object builder
    • builder

      <T> JOSEObjectBuilder<T,?,?,?,?> builder(Type type, Publisher<? extends JWK> keys)

      Returns a new JOSE object builder with the specified payload type and using the specified keys.

      The returned builder will use the specified keys to secure the JOSE object, the first succeeding key will be retained and remaining keys will be ignored. It will fail if no suitable key have been specified or if they are not consistent with the JOSE header.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      keys - the keys to consider to secure the JOSE object
      Returns:
      a new JOSE object builder
    • reader

      <T> JOSEObjectReader<T,?,?,?> reader(Class<T> type)

      Returns a new JOSE object reader with the specified payload type.

      The returned reader will try to resolve the public JWK that corresponds to the key used to secure the JOSE object based on the JOSE header. It will fail if it wasn't able to find a suitable key.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JOSE object reader
    • reader

      <T> JOSEObjectReader<T,?,?,?> reader(Type type)

      Returns a new JOSE object reader with the specified payload type.

      The returned reader will try to resolve the public JWK that corresponds to the key used to secure the JOSE object based on the JOSE header. It will fail if it wasn't able to find a suitable key.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JOSE object reader
    • reader

      <T> JOSEObjectReader<T,?,?,?> reader(Class<T> type, Publisher<? extends JWK> keys)

      Returns a new JOSE object reader with the specified payload type and using the specified keys.

      The returned reader will use the specified keys to verify or decrypt the JOSE object, the first succeeding key will be retained and remaining keys will be ignored. It will fail if no suitable key have been specified or if they are not consistent with the JOSE header.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      keys - the keys to consider to verify or decrypt the JOSE object
      Returns:
      a new JOSE object reader
    • reader

      <T> JOSEObjectReader<T,?,?,?> reader(Type type, Publisher<? extends JWK> keys)

      Returns a new JOSE object reader with the specified payload type and using the specified keys.

      The returned reader will use the specified keys to verify or decrypt the JOSE object, the first succeeding key will be retained and remaining keys will be ignored. It will fail if no suitable key have been specified or if they are not consistent with the JOSE header.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      keys - the keys to consider to verify or decrypt the JOSE object
      Returns:
      a new JOSE object reader
    • jsonBuilder

      <T> JsonJOSEObjectBuilder<T,?,?,?> jsonBuilder()

      Returns a new JSON JOSE object builder.

      Type Parameters:
      T - the payload type
      Returns:
      a new JSON JOSE object builder
    • jsonBuilder

      <T> JsonJOSEObjectBuilder<T,?,?,?> jsonBuilder(Class<T> type)

      Returns a new JSON JOSE object builder with the specified payload type.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JSON JOSE object builder
    • jsonBuilder

      <T> JsonJOSEObjectBuilder<T,?,?,?> jsonBuilder(Type type)

      Returns a new JSON JOSE object builder with the specified payload type.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JSON JOSE object builder
    • jsonReader

      <T> JsonJOSEObjectReader<T,?,?> jsonReader(Class<T> type)

      Returns a new JSON JOSE object reader with the specified payload type.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JSON JOSE object reader
    • jsonReader

      <T> JsonJOSEObjectReader<T,?,?> jsonReader(Type type)

      Returns a new JSON JOSE object reader with the specified payload type.

      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JSON JOSE object reader