Package org.keycloak.sessions
Interface StickySessionEncoderProvider
- All Superinterfaces:
Provider
- All Known Implementing Classes:
InfinispanStickySessionEncoderProviderFactory,RemoteStickySessionEncoderProviderFactory
- Author:
- Marek Posolda
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record -
Method Summary
Modifier and TypeMethodDescriptiondefault StringdecodeSessionId(String encodedSessionId) Deprecated, for removal: This API element is subject to removal in a future version.decodeSessionIdAndRoute(String encodedSessionId) Decodes the encoded session ID to extract its components, the session ID and the route.default StringencodeSessionId(String sessionId) Deprecated, for removal: This API element is subject to removal in a future version.UseencodeSessionId(String, String)instead.encodeSessionId(String message, String sessionId) Encodes the route into themessage.sessionIdRoute(String sessionId) boolean
-
Method Details
-
encodeSessionId
Deprecated, for removal: This API element is subject to removal in a future version.UseencodeSessionId(String, String)instead.- Returns:
- Encoded value to be used as the value of sticky session cookie (AUTH_SESSION_ID cookie)
-
encodeSessionId
Encodes the route into themessage.The route is computed by the
sessionId, i.e., the Keycloak instance where it is cached.- Parameters:
message- The message to encode with the route.sessionId- The session ID stored in the cache.- Returns:
- The encoded message with the route information.
- Throws:
NullPointerException- if any parameter is null.
-
decodeSessionId
Deprecated, for removal: This API element is subject to removal in a future version.UsedecodeSessionIdAndRoute(String)instead.- Parameters:
encodedSessionId- value of the sticky session cookie- Returns:
- decoded value, which represents the actual ID of the
AuthenticationSessionModel
-
decodeSessionIdAndRoute
Decodes 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.- Parameters:
encodedSessionId- The encoded session ID.- Returns:
- The
StickySessionEncoderProvider.SessionIdAndRoutewith the session ID and the route component. The route may benull. - Throws:
NullPointerException- ifencodeSessionIdisnull.
-
shouldAttachRoute
boolean shouldAttachRoute()- 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
- Parameters:
sessionId- The session ID.- Returns:
- The route for the session ID. It returns
nullif sticky session is disabled. - Throws:
NullPointerException- ifsessionIdisnull.
-
decodeSessionIdAndRoute(String)instead.