Class SessionCookieAuthentication

java.lang.Object
com.appliedolap.essbase.impl.SessionCookieAuthentication
All Implemented Interfaces:
EssAuthentication

public class SessionCookieAuthentication extends Object implements EssAuthentication
An already-established session, presented as cookies.

Sends no Authorization header at all. That isn't an oversight: Essbase accepts the session cookies on their own, and there is no username or password here to build one from - which is the entire point of this strategy.

  • Constructor Details

    • SessionCookieAuthentication

      public SessionCookieAuthentication(String sessionId, String weblogicAuthCookie)
      Parameters:
      sessionId - the JSESSIONID value
      weblogicAuthCookie - the _WL_AUTHCOOKIE_JSESSIONID value, or null if there isn't one
  • Method Details

    • authorizationHeader

      public String authorizationHeader()
      Description copied from interface: EssAuthentication
      The value for the Authorization header, or null to send none. Null is meaningful rather than a degenerate case - a cookie-borne session needs no Authorization header.
      Specified by:
      authorizationHeader in interface EssAuthentication
    • cookieHeader

      public String cookieHeader()
      Description copied from interface: EssAuthentication
      The value for the Cookie header, or null to send none.
      Specified by:
      cookieHeader in interface EssAuthentication
    • observeSetCookies

      public void observeSetCookies(List<String> setCookieHeaders)
      Picks up how long this session has left.

      A session supplied from outside arrives with no expiry attached, but the server reports one on every response, so it can simply be read as requests go by. Worth doing precisely because this strategy has nothing to fall back on: a password-backed session that dies re-authenticates silently, whereas this one just starts failing, so being able to say "12 minutes left" before that happens is the difference between a prompt and a puzzle.

      Specified by:
      observeSetCookies in interface EssAuthentication
      Parameters:
      setCookieHeaders - every Set-Cookie header value on the response, possibly empty
    • sessionExpiry

      public Optional<Instant> sessionExpiry()
      Description copied from interface: EssAuthentication
      When the current session expires, if that is known. Essbase reports it in a sessionExpiry cookie alongside the session itself, so it is only ever known for a session this library established.
      Specified by:
      sessionExpiry in interface EssAuthentication
    • sessionEnded

      public void sessionEnded()
      Stops presenting the session. There is nothing to fall back to, which is correct - signing off is what the caller asked for - but continuing to send cookies the server has discarded would turn a clear "no credentials" into a confusing "these credentials are rejected".
      Specified by:
      sessionEnded in interface EssAuthentication