Class RemoteStickySessionEncoderProviderFactory
java.lang.Object
org.keycloak.models.sessions.infinispan.remote.RemoteStickySessionEncoderProviderFactory
- All Implemented Interfaces:
EnvironmentDependentProviderFactory,Provider,ProviderFactory<StickySessionEncoderProvider>,StickySessionEncoderProvider,StickySessionEncoderProviderFactory
public class RemoteStickySessionEncoderProviderFactory
extends Object
implements StickySessionEncoderProviderFactory, EnvironmentDependentProviderFactory, StickySessionEncoderProvider
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.keycloak.sessions.StickySessionEncoderProvider
StickySessionEncoderProvider.SessionIdAndRoute -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This is called when the server shuts down.create(KeycloakSession session) decodeSessionIdAndRoute(String encodedSessionId) Decodes the encoded session ID to extract its components, the session ID and the route.Optional method used to declare that a ProviderFactory has a dependency on one or more Providers.encodeSessionId(String message, String ignored) Encodes the route into themessage.Returns the metadata for each configuration property supported by this factory.getId()voidinit(Config.Scope config) Only called once when the factory is first created.booleanisSupported(Config.Scope config) Check if the provider is supported and should be available based on the provider configuration.intorder()voidpostInit(KeycloakSessionFactory factory) Called after all provider factories have been initializedsessionIdRoute(String ignored) voidsetShouldAttachRoute(boolean shouldAttachRoute) For testing purpose onlybooleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.sessions.StickySessionEncoderProvider
decodeSessionId, encodeSessionId
-
Constructor Details
-
RemoteStickySessionEncoderProviderFactory
public RemoteStickySessionEncoderProviderFactory()
-
-
Method Details
-
create
- Specified by:
createin interfaceProviderFactory<StickySessionEncoderProvider>
-
init
Description copied from interface:ProviderFactoryOnly called once when the factory is first created.- Specified by:
initin interfaceProviderFactory<StickySessionEncoderProvider>
-
postInit
Description copied from interface:ProviderFactoryCalled after all provider factories have been initialized- Specified by:
postInitin interfaceProviderFactory<StickySessionEncoderProvider>
-
close
public void close()Description copied from interface:ProviderFactoryThis is called when the server shuts down.- Specified by:
closein interfaceProvider- Specified by:
closein interfaceProviderFactory<StickySessionEncoderProvider>
-
getId
- Specified by:
getIdin interfaceProviderFactory<StickySessionEncoderProvider>
-
order
public int order()- Specified by:
orderin interfaceProviderFactory<StickySessionEncoderProvider>
-
getConfigMetadata
Description copied from interface:ProviderFactoryReturns the metadata for each configuration property supported by this factory.- Specified by:
getConfigMetadatain interfaceProviderFactory<StickySessionEncoderProvider>- Returns:
- a list with the metadata for each configuration property supported by this factory
-
isSupported
Description copied from interface:EnvironmentDependentProviderFactoryCheck if the provider is supported and should be available based on the provider configuration.- Specified by:
isSupportedin interfaceEnvironmentDependentProviderFactory- Parameters:
config- the provider configuration- Returns:
trueif the provider is supported. Otherwise,false.
-
dependsOn
Description copied from interface:ProviderFactoryOptional method used to declare that a ProviderFactory has a dependency on one or more Providers. If a Provider is declared here, it is guaranteed that the dependenciesProviderFactory.postInit(org.keycloak.models.KeycloakSessionFactory)method will be executed before this ProviderFactory'sProviderFactory.postInit(org.keycloak.models.KeycloakSessionFactory). Similarly, it's guaranteed thatProviderFactory.close()will be called on thisProviderFactorybeforeProviderFactory.close()is called on any of the dependent ProviderFactory implementations.- Specified by:
dependsOnin interfaceProviderFactory<StickySessionEncoderProvider>
-
setShouldAttachRoute
public void setShouldAttachRoute(boolean shouldAttachRoute) Description copied from interface:StickySessionEncoderProviderFactoryFor testing purpose only- Specified by:
setShouldAttachRoutein interfaceStickySessionEncoderProviderFactory
-
encodeSessionId
Description copied from interface:StickySessionEncoderProviderEncodes the route into themessage.The route is computed by the
sessionId, i.e., the Keycloak instance where it is cached.- Specified by:
encodeSessionIdin interfaceStickySessionEncoderProvider- Parameters:
message- The message to encode with the route.ignored- The session ID stored in the cache.- Returns:
- The encoded message with the route information.
-
decodeSessionIdAndRoute
public StickySessionEncoderProvider.SessionIdAndRoute decodeSessionIdAndRoute(String encodedSessionId) Description copied from interface:StickySessionEncoderProviderDecodes the encoded session ID to extract its components, the session ID and the route.The route component may be
nullif the session ID is not correctly encoded, or the sticky session is disabled.- Specified by:
decodeSessionIdAndRoutein interfaceStickySessionEncoderProvider- Parameters:
encodedSessionId- The encoded session ID.- Returns:
- The
StickySessionEncoderProvider.SessionIdAndRoutewith the session ID and the route component. The route may benull.
-
shouldAttachRoute
public boolean shouldAttachRoute()- Specified by:
shouldAttachRoutein interfaceStickySessionEncoderProvider- Returns:
- true if information about route should be attached to the sticky session cookie by Keycloak. Otherwise, it may be attached by load balancer.
-
sessionIdRoute
- Specified by:
sessionIdRoutein interfaceStickySessionEncoderProvider- Parameters:
ignored- The session ID.- Returns:
- The route for the session ID. It returns
nullif sticky session is disabled.
-