Class KeycloakIdentityProvider
java.lang.Object
org.openremote.container.security.keycloak.KeycloakIdentityProvider
- All Implemented Interfaces:
IdentityProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected io.undertow.server.HttpHandlerprotected org.jboss.resteasy.client.jaxrs.ResteasyClientstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final intstatic final Stringstatic final intprotected org.keycloak.adapters.KeycloakConfigResolverprotected com.google.common.cache.LoadingCache<KeycloakRealmClient,org.keycloak.adapters.KeycloakDeployment> protected javax.ws.rs.core.UriBuilderprotected org.jboss.resteasy.client.jaxrs.ResteasyWebTargetstatic final Stringprotected final org.keycloak.adapters.KeycloakDeploymentprotected org.openremote.model.auth.OAuthGrantstatic final Stringstatic final intstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final intprotected ConcurrentLinkedQueue<org.keycloak.admin.client.resource.RealmsResource>protected intprotected intprotected intFields inherited from interface org.openremote.container.security.IdentityProvider
OR_ADMIN_PASSWORD, OR_ADMIN_PASSWORD_DEFAULT -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedThe suppliedOAuthGrantwill be used to authenticate with keycloak so we can programmatically make changes. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidaddClientRedirectUris(String client, List<String> redirectUrls, boolean devMode) There must be _some_ valid redirect URIs for the application or authentication will not be possible.protected com.google.common.cache.LoadingCache<KeycloakRealmClient,org.keycloak.adapters.KeycloakDeployment> protected voidenableAuthProxy(WebService webService) getAccessTokenSupplier(org.openremote.model.auth.OAuthGrant grant) Convenience method for generating access tokens from a given OAuth compliant serverorg.openremote.model.auth.OAuthPasswordGrantgetDefaultKeycloakGrant(org.openremote.model.Container container) org.keycloak.adapters.KeycloakDeploymentgetKeycloakDeployment(String realm, String clientId) final <T> TgetTokenUri(String realm) voidinit(org.openremote.model.Container container) protected voidpingKeycloak(KeycloakResource resource) voidsecureDeployment(io.undertow.servlet.api.DeploymentInfo deploymentInfo) voidsetActiveCredentials(org.openremote.model.auth.OAuthGrant grant) Update the active credentials used to interact with keycloak; the token endpoint will be overwritten with this instances keycloak server URI and for the master realm.voidstart(org.openremote.model.Container container) voidstop(org.openremote.model.Container container) protected voidprotected void
-
Field Details
-
ADMIN_CLI_CLIENT_ID
- See Also:
-
MANAGER_CLIENT_ID
- See Also:
-
DEFAULT_CLIENTS
-
OR_KEYCLOAK_HOST
- See Also:
-
OR_KEYCLOAK_HOST_DEFAULT
- See Also:
-
OR_KEYCLOAK_PORT
- See Also:
-
OR_KEYCLOAK_PORT_DEFAULT
public static final int OR_KEYCLOAK_PORT_DEFAULT- See Also:
-
KEYCLOAK_CONNECT_TIMEOUT
- See Also:
-
KEYCLOAK_CONNECT_TIMEOUT_DEFAULT
public static final int KEYCLOAK_CONNECT_TIMEOUT_DEFAULT- See Also:
-
KEYCLOAK_REQUEST_TIMEOUT
- See Also:
-
KEYCLOAK_REQUEST_TIMEOUT_DEFAULT
public static final int KEYCLOAK_REQUEST_TIMEOUT_DEFAULT- See Also:
-
KEYCLOAK_CLIENT_POOL_SIZE
- See Also:
-
KEYCLOAK_CLIENT_POOL_SIZE_DEFAULT
public static final int KEYCLOAK_CLIENT_POOL_SIZE_DEFAULT- See Also:
-
OR_IDENTITY_SESSION_MAX_MINUTES
- See Also:
-
OR_IDENTITY_SESSION_MAX_MINUTES_DEFAULT
public static final int OR_IDENTITY_SESSION_MAX_MINUTES_DEFAULT- See Also:
-
OR_IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES
- See Also:
-
OR_IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES_DEFAULT
public static final int OR_IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES_DEFAULT- See Also:
-
KEYCLOAK_AUTH_PATH
- See Also:
-
keycloakServiceUri
protected javax.ws.rs.core.UriBuilder keycloakServiceUri -
sessionTimeoutSeconds
protected int sessionTimeoutSeconds -
sessionMaxSeconds
protected int sessionMaxSeconds -
sessionOfflineTimeoutSeconds
protected int sessionOfflineTimeoutSeconds -
notAuthenticatedKeycloakDeployment
protected final org.keycloak.adapters.KeycloakDeployment notAuthenticatedKeycloakDeployment -
httpClient
protected org.jboss.resteasy.client.jaxrs.ResteasyClient httpClient -
keycloakTarget
protected org.jboss.resteasy.client.jaxrs.ResteasyWebTarget keycloakTarget -
oAuthGrant
protected org.openremote.model.auth.OAuthGrant oAuthGrant -
realmsResourcePool
protected ConcurrentLinkedQueue<org.keycloak.admin.client.resource.RealmsResource> realmsResourcePool -
keycloakDeploymentCache
protected com.google.common.cache.LoadingCache<KeycloakRealmClient,org.keycloak.adapters.KeycloakDeployment> keycloakDeploymentCache -
keycloakConfigResolver
protected org.keycloak.adapters.KeycloakConfigResolver keycloakConfigResolver -
authProxyHandler
protected io.undertow.server.HttpHandler authProxyHandler
-
-
Constructor Details
-
KeycloakIdentityProvider
protected KeycloakIdentityProvider()The suppliedOAuthGrantwill be used to authenticate with keycloak so we can programmatically make changes. It must be credentials for the master realm for a user with `admin` role so that they can perform CRUD on realms, clients and users.
-
-
Method Details
-
getDefaultKeycloakGrant
public org.openremote.model.auth.OAuthPasswordGrant getDefaultKeycloakGrant(org.openremote.model.Container container) -
init
public void init(org.openremote.model.Container container) - Specified by:
initin interfaceIdentityProvider
-
start
public void start(org.openremote.model.Container container) - Specified by:
startin interfaceIdentityProvider
-
stop
public void stop(org.openremote.model.Container container) - Specified by:
stopin interfaceIdentityProvider
-
secureDeployment
public void secureDeployment(io.undertow.servlet.api.DeploymentInfo deploymentInfo) - Specified by:
secureDeploymentin interfaceIdentityProvider
-
getKeycloak
-
syncUsers
-
getRealms
public final <T> T getRealms(Function<org.keycloak.admin.client.resource.RealmsResource, T> consumer) -
waitForKeycloak
protected void waitForKeycloak() -
pingKeycloak
- Throws:
Exception
-
getKeycloakDeployment
-
getTokenUri
-
getAccessTokenSupplier
Convenience method for generating access tokens from a given OAuth compliant server -
setActiveCredentials
public void setActiveCredentials(org.openremote.model.auth.OAuthGrant grant) Update the active credentials used to interact with keycloak; the token endpoint will be overwritten with this instances keycloak server URI and for the master realm. -
createKeycloakDeploymentCache
protected com.google.common.cache.LoadingCache<KeycloakRealmClient,org.keycloak.adapters.KeycloakDeployment> createKeycloakDeploymentCache() -
enableAuthProxy
-
addClientRedirectUris
protected abstract void addClientRedirectUris(String client, List<String> redirectUrls, boolean devMode) There must be _some_ valid redirect URIs for the application or authentication will not be possible.
-