Interface StickySessionEncoderProvider

All Superinterfaces:
Provider
All Known Implementing Classes:
InfinispanStickySessionEncoderProviderFactory, RemoteStickySessionEncoderProviderFactory

public interface StickySessionEncoderProvider extends Provider
Author:
Marek Posolda
  • Method Details

    • encodeSessionId

      @Deprecated(since="26.5", forRemoval=true) default String encodeSessionId(String sessionId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      Encoded value to be used as the value of sticky session cookie (AUTH_SESSION_ID cookie)
    • encodeSessionId

      String encodeSessionId(String message, String sessionId)
      Encodes the route into the message.

      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(since="26.5", forRemoval=true) default String decodeSessionId(String encodedSessionId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      encodedSessionId - value of the sticky session cookie
      Returns:
      decoded value, which represents the actual ID of the AuthenticationSessionModel
    • decodeSessionIdAndRoute

      StickySessionEncoderProvider.SessionIdAndRoute decodeSessionIdAndRoute(String encodedSessionId)
      Decodes the encoded session ID to extract its components, the session ID and the route.

      The route component may be null if the session ID is not correctly encoded, or the sticky session is disabled.

      Parameters:
      encodedSessionId - The encoded session ID.
      Returns:
      The StickySessionEncoderProvider.SessionIdAndRoute with the session ID and the route component. The route may be null.
      Throws:
      NullPointerException - if encodeSessionId is null.
    • 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

      String sessionIdRoute(String sessionId)
      Parameters:
      sessionId - The session ID.
      Returns:
      The route for the session ID. It returns null if sticky session is disabled.
      Throws:
      NullPointerException - if sessionId is null.