Interface JWKFactory<A extends JWK,B extends JWKBuilder<A,?>,C extends JWKGenerator<A,?>>

Type Parameters:
A - the JWK type built by the builder
B - the JWK builder type
C - the JWK generator type
All Known Subinterfaces:
ECJWKFactory<A,B,C>, EdECJWKFactory<A,B,C>, OCTJWKFactory<A,B,C>, OKPJWKFactory<A,B,C,D,E>, PBES2JWKFactory<A,B,C>, RSAJWKFactory<A,B,C>, X509JWKFactory<A,B,C,D,E>, XECJWKFactory<A,B,C>
All Known Implementing Classes:
AbstractJWKFactory, AbstractOKPJWKFactory, AbstractX509JWKFactory, GenericECJWKFactory, GenericEdECJWKFactory, GenericOCTJWKFactory, GenericPBES2JWKFactory, GenericRSAJWKFactory, GenericXECJWKFactory

public interface JWKFactory<A extends JWK,B extends JWKBuilder<A,?>,C extends JWKGenerator<A,?>>

A JWK factory is used to build, read or generate a particular type of key.

Since:
1.5
Author:
Jeremy Kuhn
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a new JWK builder for the key type supported by the factory.
    reactor.core.publisher.Mono<A>
    generate(String alg, Map<String,Object> parameters)
    Generates a new key using the specified parameters.
    Returns a new JWK builder for the key type supported by the factory.
    reactor.core.publisher.Mono<A>
    read(String jwk)
    Reads the specified JWK or JWK set serialized as JSON.
    reactor.core.publisher.Mono<A>
    Read the specified JWK or JWK set represented in the specified map.
    boolean
    Determines whether the factory supports the specified key type.
    boolean
    Determines whether the factory supports the specified algorithm.
  • Method Details

    • builder

      B builder()

      Returns a new JWK builder for the key type supported by the factory.

      Returns:
      a new JWK builder
    • generator

      C generator()

      Returns a new JWK builder for the key type supported by the factory.

      Returns:
      a new JWK generator
    • supports

      boolean supports(String kty)

      Determines whether the factory supports the specified key type.

      Parameters:
      kty - a JWA key type
      Returns:
      true if the factory supports the key type, false otherwise
    • supportsAlgorithm

      boolean supportsAlgorithm(String alg)

      Determines whether the factory supports the specified algorithm.

      Parameters:
      alg - a JWA algorithm
      Returns:
      true if the factory supports the algorithm, false otherwise
    • read

      reactor.core.publisher.Mono<A> read(String jwk) throws JWKReadException, JWKBuildException, JWKResolveException, JWKProcessingException

      Reads the specified JWK or JWK set serialized as JSON.

      Parameters:
      jwk - a JSON serialized JWK or JWK set
      Returns:
      a publisher of keys
      Throws:
      JWKReadException - if there was an error reading the input or a particular key
      JWKBuildException - if there was an error building a key
      JWKResolveException - if there was an error resolving a key
      JWKProcessingException - if there was an error processing a key
    • read

      Read the specified JWK or JWK set represented in the specified map.

      Parameters:
      jwk - a map representing a JWK or a JWK set
      Returns:
      a publisher of keys
      Throws:
      JWKReadException - if there was an error reading the input or a particular key
      JWKBuildException - if there was an error building a key
      JWKResolveException - if there was an error resolving a key
      JWKProcessingException - if there was an error processing a key
    • generate

      reactor.core.publisher.Mono<A> generate(String alg, Map<String,Object> parameters) throws JWKGenerateException, JWKProcessingException

      Generates a new key using the specified parameters.

      This is a convenience method, you should prefer using generator() which is more robust.

      Parameters:
      alg - a JWA algorithm
      parameters - a map of key parameters
      Returns:
      a single publisher of key
      Throws:
      JWKGenerateException - if there was an error generating the key
      JWKProcessingException - if there was a processing error