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) booleanReturns a managedKeyManager.Returns when the next certificate rotation is required.voidReloads the most recent certificate and apply it to theKeyManagerandTrustManager.voidA new certificate must be generated.voidsetRotationPeriod(Duration rotationPeriod) booleanReturns a managedTrustManager.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:JGroupsCertificateProviderA 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:
rotateCertificatein interfaceJGroupsCertificateProvider
-
reloadCertificate
public void reloadCertificate()Description copied from interface:JGroupsCertificateProviderReloads the most recent certificate and apply it to theKeyManagerandTrustManager.This method must be implemented when
JGroupsCertificateProvider.supportRotateAndReload()returnstrue.- Specified by:
reloadCertificatein interfaceJGroupsCertificateProvider
-
nextRotation
Description copied from interface:JGroupsCertificateProviderReturns 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:
nextRotationin interfaceJGroupsCertificateProvider- Returns:
- The time until the next rotation.
-
supportRotateAndReload
public boolean supportRotateAndReload()- Specified by:
supportRotateAndReloadin interfaceJGroupsCertificateProvider- Returns:
trueif rotation and reload requests is possible.
-
keyManager
Description copied from interface:JGroupsCertificateProviderReturns 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:
keyManagerin interfaceJGroupsCertificateProvider- Returns:
- The
KeyManagerto use by theSSLContext.
-
trustManager
Description copied from interface:JGroupsCertificateProviderReturns 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:
trustManagerin interfaceJGroupsCertificateProvider- Returns:
- The
TrustManagerto use by theSSLContext.
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceJGroupsCertificateProvider- Returns:
trueif TLS is enabled for JGroups communication.
-
setRotationPeriod
-
getRotationPeriod
-
getCurrentCertificate
-