Class AbstractJWKBuilder<A extends JWK,B extends AbstractJWKBuilder<A,B>>
- Type Parameters:
A- the JWK typeB- the JWK builder type
- All Implemented Interfaces:
JWKBuilder<A,,B> Cloneable
- Direct Known Subclasses:
AbstractX509JWKBuilder,GenericOCTJWKBuilder,GenericPBES2JWKBuilder
Base JSON Web Key builder implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe Algorithm parameter as defined by RFC7517 Section 4.4.protected final JOSEConfigurationThe JOSE module configuration.protected final JWKStoreThe JWK Key store.protected KeyThe underlying key.The Key Operations parameter as defined by RFC7517 Section 4.3.protected final JWKKeyResolverThe JWK Key resolver.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
ConstructorsConstructorDescriptionAbstractJWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver) Creates a JWK builder.AbstractJWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver, Map<String, Object> parameters) Creates a JWK builder initialized with the specified parameters map. -
Method Summary
Modifier and TypeMethodDescriptionSpecifies the algorithm intended for use with the key.reactor.core.publisher.Mono<A>build()Returns a single publisher that builds the key.protected abstract reactor.core.publisher.Mono<A>doBuild()Builds the JWK after all checks and processing have terminated successfully.Specified 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 reactor.core.publisher.Mono<Void>resolve()Resolves the JWK to build.protected reactor.core.publisher.Mono<JWK>Tries to resolve the JWK from the JWK store.protected abstract reactor.core.publisher.Mono<Void>resolveKey(Key key) Resolves the specified key into the builder.protected voidSets the specified parameter into the builder.
-
Field Details
-
configuration
The JOSE module configuration. -
jwkStore
The JWK Key store. -
keyResolver
The JWK Key resolver. -
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. -
key
The underlying key.
-
-
Constructor Details
-
AbstractJWKBuilder
public AbstractJWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver) Creates a JWK builder.
- Parameters:
configuration- the JOSE module configurationjwkStore- a JWK storekeyResolver- a JWK key resolver
-
AbstractJWKBuilder
public AbstractJWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver, Map<String, Object> parameters) throws JWKReadExceptionCreates a JWK builder initialized with the specified parameters map.
- Parameters:
configuration- the JOSE module configurationjwkStore- a JWK storekeyResolver- a JWK key resolverparameters- a parameters map used to initialize the builder- Throws:
JWKReadException- if there was an error reading the parameters map
-
-
Method Details
-
set
Sets the specified parameter into the builder.
Unsupported parameters are ignored.
- Parameters:
name- the parameter namevalue- the parameter value- Throws:
JWKReadException- if there was an error reading the value
-
publicKeyUse
Description copied from interface:JWKBuilderSpecifies the public key use.
- Specified by:
publicKeyUsein interfaceJWKBuilder<A extends JWK,B extends AbstractJWKBuilder<A, B>> - Parameters:
use- the public key use- Returns:
- this builder
-
keyOperations
Description copied from interface:JWKBuilderSpecifies the set of key operations for which the key is intended to be used.
- Specified by:
keyOperationsin interfaceJWKBuilder<A extends JWK,B extends AbstractJWKBuilder<A, B>> - Parameters:
key_ops- a list of key operations- Returns:
- this builder
-
algorithm
Description copied from interface:JWKBuilderSpecifies the algorithm intended for use with the key.
- Specified by:
algorithmin interfaceJWKBuilder<A extends JWK,B extends AbstractJWKBuilder<A, B>> - Parameters:
alg- a JWA algorithm- Returns:
- this builder
-
keyId
Description copied from interface:JWKBuilderSpecified the key id that uniquely identifies the key.
- Specified by:
keyIdin interfaceJWKBuilder<A extends JWK,B extends AbstractJWKBuilder<A, B>> - Parameters:
kid- a unique key id- Returns:
- this builder
-
build
public reactor.core.publisher.Mono<A> build() throws JWKBuildException, JWKResolveException, JWKProcessingExceptionDescription copied from interface:JWKBuilderReturns a single publisher that builds the key.
- Specified by:
buildin interfaceJWKBuilder<A extends JWK,B extends AbstractJWKBuilder<A, B>> - Returns:
- a single key publisher
- Throws:
JWKBuildException- if there was an error building the keyJWKResolveException- if there was an error resolving the keyJWKProcessingException- if there was an error processing the key
-
resolveFromJWKStore
Tries to resolve the JWK from the JWK store.
- Returns:
- a single JWK publisher or an empty publisher if there's no JWK corresponding to the builder's parameters in the JWK store
- Throws:
JWKResolveException- if there was an error accessing the JWK store
-
resolve
protected reactor.core.publisher.Mono<Void> resolve() throws JWKBuildException, JWKResolveException, JWKProcessingExceptionResolves the JWK to build.
This method basically resolves resources such as keys or certificates and verifies that the builder's parameters are consistent.
- Returns:
- an empty single publisher which completes in error if the key is not consistent with the builder's parameters
- Throws:
JWKBuildException- if there was an error building the JWKJWKResolveException- if there was an error resolving the JWKJWKProcessingException- if there was a JWK processing error
-
resolveKey
protected abstract reactor.core.publisher.Mono<Void> resolveKey(Key key) throws JWKBuildException, JWKResolveException, JWKProcessingException Resolves the specified key into the builder.
This method basically verifies that the key is valid and consistent with the builder's parameters and eventually populates the builder with the key.
- Parameters:
key- a key- Returns:
- an empty single publisher which completes in error if the key is not consistent with the builder's parameters
- Throws:
JWKBuildException- if there was an error building the JWKJWKResolveException- if there was an error resolving the keyJWKProcessingException- if there was a JWK processing error
-
doBuild
protected abstract reactor.core.publisher.Mono<A> doBuild() throws JWKBuildException, JWKProcessingExceptionBuilds the JWK after all checks and processing have terminated successfully.
- Returns:
- a single JWK publisher
- Throws:
JWKBuildException- if there was an error building the JWKJWKProcessingException- if there was a JWK processing error
-