Module io.inverno.mod.security.jose
Class AbstractJWKGenerator<A extends JWK,B extends AbstractJWKGenerator<A,B>>
java.lang.Object
io.inverno.mod.security.jose.internal.jwk.AbstractJWKGenerator<A,B>
- Type Parameters:
A- the JWK typeB- the JWK generator type
- All Implemented Interfaces:
JWKGenerator<A,B>
- Direct Known Subclasses:
AbstractX509JWKGenerator,GenericOCTJWKGenerator,GenericPBES2JWKGenerator
public abstract class AbstractJWKGenerator<A extends JWK,B extends AbstractJWKGenerator<A,B>>
extends Object
implements JWKGenerator<A,B>
Base JSON Web Key generator implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe Algorithm parameter as defined by RFC7517 Section 4.4.The Key Operations parameter as defined by RFC7517 Section 4.3.protected StringThe Key id parameter as defined by RFC7517 Section 4.5.protected StringThe Public Key Use parameter as defined by RFC7517 Section 4.2. -
Constructor Summary
ConstructorsConstructorDescriptionCreates JWK generator.AbstractJWKGenerator(Map<String, Object> parameters) Creates JWK generator initialized with the specified parameters map. -
Method Summary
Modifier and TypeMethodDescriptionSpecifies the algorithm intended for use with the key.protected abstract reactor.core.publisher.Mono<A>Generates the JWK after all checks and processing have terminated successfully.reactor.core.publisher.Mono<A>generate()Returns a single publisher that generates a new key.Specifies the key id that uniquely identifies the key.keyOperations(String... key_ops) Specifies the set of key operations for which the key is intended to be used.publicKeyUse(String use) Specifies the public key use.protected voidSets the specified parameter into the generator.protected reactor.core.publisher.Mono<Void>verify()Verifies that the generator's parameters are consistent and that we can proceed with the generation of the key.
-
Field Details
-
use
The Public Key Use parameter as defined by RFC7517 Section 4.2. -
key_ops
The Key Operations parameter as defined by RFC7517 Section 4.3. -
alg
The Algorithm parameter as defined by RFC7517 Section 4.4. -
kid
The Key id parameter as defined by RFC7517 Section 4.5.
-
-
Constructor Details
-
AbstractJWKGenerator
public AbstractJWKGenerator()Creates JWK generator.
-
AbstractJWKGenerator
Creates JWK generator initialized with the specified parameters map.
- Parameters:
parameters- a parameters map used to initialize the generator- Throws:
JWKGenerateException- if there was an error reading the parameters map
-
-
Method Details
-
set
Sets the specified parameter into the generator.
Unsupported parameters are ignored.
- Parameters:
name- the parameter namevalue- the parameter value- Throws:
JWKGenerateException- if there was an error reading the value
-
publicKeyUse
Description copied from interface:JWKGeneratorSpecifies the public key use.
- Specified by:
publicKeyUsein interfaceJWKGenerator<A extends JWK,B extends AbstractJWKGenerator<A, B>> - Parameters:
use- the public key use- Returns:
- this generator
-
keyOperations
Description copied from interface:JWKGeneratorSpecifies the set of key operations for which the key is intended to be used.
- Specified by:
keyOperationsin interfaceJWKGenerator<A extends JWK,B extends AbstractJWKGenerator<A, B>> - Parameters:
key_ops- a list of key operations- Returns:
- this generator
-
keyId
Description copied from interface:JWKGeneratorSpecifies the key id that uniquely identifies the key.
- Specified by:
keyIdin interfaceJWKGenerator<A extends JWK,B extends AbstractJWKGenerator<A, B>> - Parameters:
kid- a unique key id- Returns:
- this generator
-
algorithm
Description copied from interface:JWKGeneratorSpecifies the algorithm intended for use with the key.
- Specified by:
algorithmin interfaceJWKGenerator<A extends JWK,B extends AbstractJWKGenerator<A, B>> - Parameters:
alg- a JWA algorithm- Returns:
- this generator
-
generate
public reactor.core.publisher.Mono<A> generate() throws JWKGenerateException, JWKProcessingExceptionDescription copied from interface:JWKGeneratorReturns a single publisher that generates a new key.
- Specified by:
generatein interfaceJWKGenerator<A extends JWK,B extends AbstractJWKGenerator<A, B>> - Returns:
- a single key publisher
- Throws:
JWKGenerateException- if there was an error generating the keyJWKProcessingException- if there was a processing error
-
verify
protected reactor.core.publisher.Mono<Void> verify() throws JWKGenerateException, JWKProcessingExceptionVerifies that the generator's parameters are consistent and that we can proceed with the generation of the key.
- Returns:
- an empty single publisher which completes in error if generator's parameters are invalid or inconsistent
- Throws:
JWKGenerateException- if there was an error generating the JWKJWKProcessingException- if there was a JWK processing error
-
doGenerate
protected abstract reactor.core.publisher.Mono<A> doGenerate() throws JWKGenerateException, JWKProcessingExceptionGenerates the JWK after all checks and processing have terminated successfully.
- Returns:
- a single JWK publisher
- Throws:
JWKGenerateException- if there was an error generating the JWKJWKProcessingException- if there was a JWK processing error
-