Class AbstractX509JWKBuilder<A extends PublicKey,B extends PrivateKey,C extends X509JWK<A,B>,D extends AbstractX509JWKBuilder<A,B,C,D>>
- Type Parameters:
A- the public key typeB- the private key typeC- the X.509 JWK typeD- the X.509 JWK builder type
- All Implemented Interfaces:
JWKBuilder<C,,D> X509JWKBuilder<A,,B, C, D> Cloneable
- Direct Known Subclasses:
AbstractOKPJWKBuilder,GenericECJWKBuilder,GenericRSAJWKBuilder
Base X.509 JSON Web Key builder implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected X509CertificateThe underlying certificate.protected final X509JWKCertPathValidatorThe X.509 Certificate path validatorprotected booleanIndicates whether the built JWK can be trusted.protected final JWKURLResolverThe JWK URL resolver.protected String[]The X.509 Certificate Chain parameter as defined by RFC7517 Section 4.7.protected StringThe X.509 Certificate SHA-1 Thumbprint parameter as defined by RFC7517 Section 4.8.protected StringThe X.509 Certificate SHA-256 Thumbprint parameter as defined by RFC7517 Section 4.9.protected URIThe X.509 URL parameter as defined by RFC7517 Section 4.6.Fields inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractJWKBuilder
alg, configuration, jwkStore, key, key_ops, keyResolver, kid, use -
Constructor Summary
ConstructorsConstructorDescriptionAbstractX509JWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver, JWKURLResolver urlResolver, X509JWKCertPathValidator certPathValidator) Creates an X.509 JWK builder.AbstractX509JWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver, JWKURLResolver urlResolver, X509JWKCertPathValidator certPathValidator, Map<String, Object> parameters) Creates an X.509 JWK builder initialized with the specified parameters map. -
Method Summary
Modifier and TypeMethodDescriptionprotected reactor.core.publisher.Mono<Void>resolve()Resolves the JWK to build.protected reactor.core.publisher.Mono<Void>resolveCertificate(X509Certificate certificate) Resolves the specified certificate into the builder.protected reactor.core.publisher.Mono<JWK>Tries to resolve the JWK from the JWK store.protected voidSets the specified parameter into the builder.x509CertificateChain(String[] x5c) specifies the X.509 certificates chain.Specifies the X.509 certificate SHA1 thumbprint.x509CertificateSHA256Thumbprint(String x5t_S256) Specifies the X.509 certificate SHA256 thumbprint.x509CertificateURL(URI x5u) Specifies the X.509 certificate or certificates chain URL.Methods inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractJWKBuilder
algorithm, build, doBuild, keyId, keyOperations, publicKeyUse, resolveKeyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.inverno.mod.security.jose.jwk.JWKBuilder
algorithm, build, keyId, keyOperations, publicKeyUse
-
Field Details
-
urlResolver
The JWK URL resolver. -
certPathValidator
The X.509 Certificate path validator -
x5u
The X.509 URL parameter as defined by RFC7517 Section 4.6. -
x5c
The X.509 Certificate Chain parameter as defined by RFC7517 Section 4.7. -
x5t
The X.509 Certificate SHA-1 Thumbprint parameter as defined by RFC7517 Section 4.8. -
x5t_S256
The X.509 Certificate SHA-256 Thumbprint parameter as defined by RFC7517 Section 4.9. -
keyTrusted
protected volatile boolean keyTrustedIndicates whether the built JWK can be trusted. -
certificate
The underlying certificate.
-
-
Constructor Details
-
AbstractX509JWKBuilder
public AbstractX509JWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver, JWKURLResolver urlResolver, X509JWKCertPathValidator certPathValidator) Creates an X.509 JWK builder.
- Parameters:
configuration- the JOSE module configurationjwkStore- a JWK storekeyResolver- a JWK key resolverurlResolver- a JWK URL resolvercertPathValidator- an X.509 certificate path validator
-
AbstractX509JWKBuilder
public AbstractX509JWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver, JWKURLResolver urlResolver, X509JWKCertPathValidator certPathValidator, Map<String, Object> parameters) throws JWKReadExceptionCreates an X.509 JWK builder initialized with the specified parameters map.
- Parameters:
configuration- the JOSE module configurationjwkStore- a JWK storekeyResolver- a JWK key resolverurlResolver- a JWK URL resolvercertPathValidator- an X.509 certificate path validatorparameters- 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.
- Overrides:
setin classAbstractJWKBuilder<C extends X509JWK<A,B>, D extends AbstractX509JWKBuilder<A, B, C, D>> - Parameters:
name- the parameter namevalue- the parameter value- Throws:
JWKReadException- if there was an error reading the value
-
x509CertificateURL
Description copied from interface:X509JWKBuilderSpecifies the X.509 certificate or certificates chain URL.
- Specified by:
x509CertificateURLin interfaceX509JWKBuilder<A extends PublicKey,B extends PrivateKey, C extends X509JWK<A, B>, D extends AbstractX509JWKBuilder<A, B, C, D>> - Parameters:
x5u- the X.509 certificate or certificate chain URL- Returns:
- this builder
-
x509CertificateChain
Description copied from interface:X509JWKBuilderspecifies the X.509 certificates chain.
- Specified by:
x509CertificateChainin interfaceX509JWKBuilder<A extends PublicKey,B extends PrivateKey, C extends X509JWK<A, B>, D extends AbstractX509JWKBuilder<A, B, C, D>> - Parameters:
x5c- the X.509 certificates chain- Returns:
- this builder
-
x509CertificateSHA1Thumbprint
Description copied from interface:X509JWKBuilderSpecifies the X.509 certificate SHA1 thumbprint.
- Specified by:
x509CertificateSHA1Thumbprintin interfaceX509JWKBuilder<A extends PublicKey,B extends PrivateKey, C extends X509JWK<A, B>, D extends AbstractX509JWKBuilder<A, B, C, D>> - Parameters:
x5t- the X.509 certificate SHA1 thumbprint- Returns:
- this builder
-
x509CertificateSHA256Thumbprint
Description copied from interface:X509JWKBuilderSpecifies the X.509 certificate SHA256 thumbprint.
- Specified by:
x509CertificateSHA256Thumbprintin interfaceX509JWKBuilder<A extends PublicKey,B extends PrivateKey, C extends X509JWK<A, B>, D extends AbstractX509JWKBuilder<A, B, C, D>> - Parameters:
x5t_S256- the X.509 certificate SHA256 thumbprint- Returns:
- this builder
-
resolve
protected reactor.core.publisher.Mono<Void> resolve() throws JWKBuildException, JWKResolveException, JWKProcessingExceptionDescription copied from class:AbstractJWKBuilderResolves the JWK to build.
This method basically resolves resources such as keys or certificates and verifies that the builder's parameters are consistent.
- Overrides:
resolvein classAbstractJWKBuilder<C extends X509JWK<A,B>, D extends AbstractX509JWKBuilder<A, B, C, D>> - 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
-
resolveFromJWKStore
Description copied from class:AbstractJWKBuilderTries to resolve the JWK from the JWK store.
- Overrides:
resolveFromJWKStorein classAbstractJWKBuilder<C extends X509JWK<A,B>, D extends AbstractX509JWKBuilder<A, B, C, D>> - 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
-
resolveCertificate
protected reactor.core.publisher.Mono<Void> resolveCertificate(X509Certificate certificate) throws JWKBuildException, JWKResolveException, JWKProcessingException Resolves the specified certificate into the builder.
This method basically verifies that the certificate is valid and consistent with the builder's parameters and eventually populates the builder with the certificate key.
- Parameters:
certificate- a certificate- Returns:
- an empty single publisher which completes in error if the resolved key is invalid or inconsistent with the builder's parameters
- Throws:
JWKBuildException- if there was an error building the JWKJWKResolveException- if there was an error resolving the certificateJWKProcessingException- if there was a JWK processing error
-