Class DatabaseJGroupsCertificateProvider
- All Implemented Interfaces:
Provider
,JGroupsCertificateProvider
JGroupsCertificateProvider
implementation that stores the certificates in the database.
The generated certificate is self-signed, and the database is used to share the certificate amongst the Keycloak instances in the cluster. This implementation supports rotation and reloading of the certificate. The rotation can happen at any time, or by a periodic task, or by sysadmin request.
-
Field Summary
FieldsFields inherited from interface org.keycloak.spi.infinispan.JGroupsCertificateProvider
DISABLED
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(KeycloakSessionFactory factory, Duration rotationPeriod) boolean
Returns a managedKeyManager
.Returns when the next certificate rotation is required.void
Reloads the most recent certificate and apply it to theKeyManager
andTrustManager
.void
A new certificate must be generated.void
setRotationPeriod
(Duration rotationPeriod) boolean
Returns a managedTrustManager
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.keycloak.spi.infinispan.JGroupsCertificateProvider
close
-
Field Details
-
CERTIFICATE_ID
- See Also:
-
-
Method Details
-
create
public static DatabaseJGroupsCertificateProvider create(KeycloakSessionFactory factory, Duration rotationPeriod) -
rotateCertificate
public void rotateCertificate()Description copied from interface:JGroupsCertificateProvider
A new certificate must be generated.The generated certificate should not be used immediately, but only after
JGroupsCertificateProvider.reloadCertificate()
is invoked.This method must be implemented when
JGroupsCertificateProvider.supportRotateAndReload()
returnstrue
.- Specified by:
rotateCertificate
in interfaceJGroupsCertificateProvider
-
reloadCertificate
public void reloadCertificate()Description copied from interface:JGroupsCertificateProvider
Reloads the most recent certificate and apply it to theKeyManager
andTrustManager
.This method must be implemented when
JGroupsCertificateProvider.supportRotateAndReload()
returnstrue
.- Specified by:
reloadCertificate
in interfaceJGroupsCertificateProvider
-
nextRotation
Description copied from interface:JGroupsCertificateProvider
Returns when the next certificate rotation is required.It is used to automatically rotate certificates periodically.
This method must be implemented when
JGroupsCertificateProvider.supportRotateAndReload()
returnstrue
.- Specified by:
nextRotation
in interfaceJGroupsCertificateProvider
- Returns:
- The time until the next rotation.
-
supportRotateAndReload
public boolean supportRotateAndReload()- Specified by:
supportRotateAndReload
in interfaceJGroupsCertificateProvider
- Returns:
true
if rotation and reload requests is possible.
-
keyManager
Description copied from interface:JGroupsCertificateProvider
Returns a managedKeyManager
.If
JGroupsCertificateProvider.supportRotateAndReload()
returnstrue
, the instance returned must be updated with the new certificate whenJGroupsCertificateProvider.reloadCertificate()
. This method is invoked only once at boot time.This method must be implemented when
JGroupsCertificateProvider.isEnabled()
returnstrue
.- Specified by:
keyManager
in interfaceJGroupsCertificateProvider
- Returns:
- The
KeyManager
to use by theSSLContext
.
-
trustManager
Description copied from interface:JGroupsCertificateProvider
Returns a managedTrustManager
.If
JGroupsCertificateProvider.supportRotateAndReload()
returnstrue
, the instance returned must be updated with the new certificate whenJGroupsCertificateProvider.reloadCertificate()
. This method is invoked only once at boot time.This method must be implemented when
JGroupsCertificateProvider.isEnabled()
returnstrue
.- Specified by:
trustManager
in interfaceJGroupsCertificateProvider
- Returns:
- The
TrustManager
to use by theSSLContext
.
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceJGroupsCertificateProvider
- Returns:
true
if TLS is enabled for JGroups communication.
-
setRotationPeriod
-
getRotationPeriod
-
getCurrentCertificate
-