Class SessionContext

java.lang.Object
dev.frostlake.security.SessionContext

public class SessionContext extends Object
Manages the current user session context including active user and role
  • Constructor Details

    • SessionContext

      public SessionContext()
  • Method Details

    • getCurrentStatement

      public String getCurrentStatement()
      The SQL text of the statement this session is currently executing.
    • setCurrentStatement

      public void setCurrentStatement(String currentStatement)
    • getLastTransactionId

      public String getLastTransactionId()
      The id of the session's last completed (committed or rolled-back) transaction.
    • setLastTransactionId

      public void setLastTransactionId(String lastTransactionId)
    • getSessionId

      public String getSessionId()
    • getCurrentUser

      public String getCurrentUser()
    • setCurrentUser

      public void setCurrentUser(String currentUser)
    • getDisplayUser

      public String getDisplayUser()
      Display name returned by CURRENT_USER() — may differ from the internal security user.
    • setDisplayUser

      public void setDisplayUser(String displayUser)
    • getCurrentRole

      public String getCurrentRole()
    • setCurrentRole

      public void setCurrentRole(String currentRole)
    • getActiveRoles

      public Set<String> getActiveRoles()
    • addActiveRole

      public void addActiveRole(String role)
    • clearActiveRoles

      public void clearActiveRoles()
    • isSecurityEnabled

      public boolean isSecurityEnabled()
    • setSecurityEnabled

      public void setSecurityEnabled(boolean securityEnabled)
    • reset

      public void reset()
    • setSessionParameter

      public void setSessionParameter(String name, Object value)
    • getSessionParameter

      public Object getSessionParameter(String name)
    • unsetSessionParameter

      public void unsetSessionParameter(String name)
    • setSessionVariable

      public void setSessionVariable(String name, Object value)
      Define, or redefine, the session variable SET names.
    • getSessionVariable

      public Object getSessionVariable(String name)
      A session variable's value, or null when SET never defined one of that name.
    • unsetSessionVariable

      public void unsetSessionVariable(String name)
      Forget a session variable UNSET removed. Removing a name no SET defined is silently accepted.
    • isSessionVariable

      public boolean isSessionVariable(String name)
      Whether SET defined a session variable of this name. A session PARAMETER is not one: live refuses $TIMEZONE and $QUERY_TAG unless a SET made a variable of that name.
    • getAllSessionParameters

      public Map<String,Object> getAllSessionParameters()
    • getAllSessionVariables

      public Map<String,Object> getAllSessionVariables()
      Every session variable SET defined, in creation order — what SHOW VARIABLES lists.