Class SystemdProviderFactory
java.lang.Object
com.github.jpmsilva.jsystemd.keycloak.SystemdProviderFactory
- All Implemented Interfaces:
org.keycloak.provider.ProviderFactory<SystemdProvider>
public class SystemdProviderFactory
extends Object
implements org.keycloak.provider.ProviderFactory<SystemdProvider>
Integrates Keycloak with systemd, following the life cycle of Keycloak:
- when Keycloak initializes its providers, at the start of its bootstrap, the integration starts, and the status shows
Startup: bootstrapping; - once Keycloak has completed its bootstrap, which includes migrating the database and importing realms, and its HTTP server listens, systemd is
told that Keycloak is ready. Either may happen last: Keycloak bootstraps once its HTTP server listens when the health endpoints are enabled, answering
503 until then, and before it starts its HTTP server otherwise. When the health endpoints are enabled, Keycloak is also only ready once its readiness
health checks, those of its
/health/readyendpoint, are all up; - as soon as Keycloak is told to stop, systemd is told that it is stopping, and the status shows
Shutdown: stopping; - once Keycloak closes its providers, the integration stops.
The watchdog heartbeats are sent when the service unit sets WatchdogSec, and the status shows the status of the JVM.
- Author:
- Joao Silva
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stops the integration with systemd, once Keycloak closes its providers, telling systemd that Keycloak is stopping if not done before.create(org.keycloak.models.KeycloakSession session) List<org.keycloak.provider.ProviderConfigProperty>getId()voidinit(org.keycloak.Config.Scope config) Starts the integration with systemd, when Keycloak initializes its providers, at the start of its bootstrap.voidpostInit(org.keycloak.models.KeycloakSessionFactory factory) Tells systemd that Keycloak is ready once it has completed its bootstrap, and its HTTP server listens.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.provider.ProviderFactory
dependsOn, order
-
Field Details
-
ID
The id of the factory, which is part of its options.- See Also:
-
-
Constructor Details
-
SystemdProviderFactory
public SystemdProviderFactory()Creates a new instance, as Keycloak does.
-
-
Method Details
-
getId
- Specified by:
getIdin interfaceorg.keycloak.provider.ProviderFactory<SystemdProvider>
-
create
- Specified by:
createin interfaceorg.keycloak.provider.ProviderFactory<SystemdProvider>
-
init
public void init(org.keycloak.Config.Scope config) Starts the integration with systemd, when Keycloak initializes its providers, at the start of its bootstrap.- Specified by:
initin interfaceorg.keycloak.provider.ProviderFactory<SystemdProvider>- Parameters:
config- the options of the factory
-
postInit
public void postInit(org.keycloak.models.KeycloakSessionFactory factory) Tells systemd that Keycloak is ready once it has completed its bootstrap, and its HTTP server listens.- Specified by:
postInitin interfaceorg.keycloak.provider.ProviderFactory<SystemdProvider>- Parameters:
factory- the session factory of Keycloak
-
close
public void close()Stops the integration with systemd, once Keycloak closes its providers, telling systemd that Keycloak is stopping if not done before.- Specified by:
closein interfaceorg.keycloak.provider.ProviderFactory<SystemdProvider>
-
getConfigMetadata
- Specified by:
getConfigMetadatain interfaceorg.keycloak.provider.ProviderFactory<SystemdProvider>
-