Module io.inverno.mod.security.jose
Package io.inverno.mod.security.jose.jwk
Interface JWKFactory<A extends JWK,B extends JWKBuilder<A,?>,C extends JWKGenerator<A,?>>
- Type Parameters:
A
- the JWK type built by the builderB
- the JWK builder typeC
- 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>
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 TypeMethodDescriptionbuilder()
Returns a new JWK builder for the key type supported by the factory.Generates a new key using the specified parameters.Returns a new JWK builder for the key type supported by the factory.Reads the specified JWK or JWK set serialized as JSON.Read the specified JWK or JWK set represented in the specified map.boolean
Determines whether the factory supports the specified key type.boolean
supportsAlgorithm
(String alg) 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
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
Determines whether the factory supports the specified algorithm.
- Parameters:
alg
- a JWA algorithm- Returns:
- true if the factory supports the algorithm, false otherwise
-
read
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 keyJWKBuildException
- if there was an error building a keyJWKResolveException
- if there was an error resolving a keyJWKProcessingException
- if there was an error processing a key
-
read
Mono<A> read(Map<String, Object> jwk) throws JWKReadException, JWKBuildException, JWKResolveException, JWKProcessingExceptionRead 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 keyJWKBuildException
- if there was an error building a keyJWKResolveException
- if there was an error resolving a keyJWKProcessingException
- if there was an error processing a key
-
generate
Mono<A> generate(String alg, Map<String, Object> parameters) throws JWKGenerateException, JWKProcessingExceptionGenerates 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 algorithmparameters
- a map of key parameters- Returns:
- a single publisher of key
- Throws:
JWKGenerateException
- if there was an error generating the keyJWKProcessingException
- if there was a processing error
-