Package dev.frostlake.security
Class SessionContext
java.lang.Object
dev.frostlake.security.SessionContext
Manages the current user session context including active user and role
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActiveRole(String role) voidEvery session variable SET defined, in creation order — what SHOW VARIABLES lists.The SQL text of the statement this session is currently executing.Display name returned by CURRENT_USER() — may differ from the internal security user.The id of the session's last completed (committed or rolled-back) transaction.getSessionParameter(String name) getSessionVariable(String name) A session variable's value, or null when SET never defined one of that name.booleanbooleanisSessionVariable(String name) Whether SET defined a session variable of this name.voidreset()voidsetCurrentRole(String currentRole) voidsetCurrentStatement(String currentStatement) voidsetCurrentUser(String currentUser) voidsetDisplayUser(String displayUser) voidsetLastTransactionId(String lastTransactionId) voidsetSecurityEnabled(boolean securityEnabled) voidsetSessionParameter(String name, Object value) voidsetSessionVariable(String name, Object value) Define, or redefine, the session variable SET names.voidunsetSessionParameter(String name) voidunsetSessionVariable(String name) Forget a session variable UNSET removed.
-
Constructor Details
-
SessionContext
public SessionContext()
-
-
Method Details
-
getCurrentStatement
The SQL text of the statement this session is currently executing. -
setCurrentStatement
-
getLastTransactionId
The id of the session's last completed (committed or rolled-back) transaction. -
setLastTransactionId
-
getSessionId
-
getCurrentUser
-
setCurrentUser
-
getDisplayUser
Display name returned by CURRENT_USER() — may differ from the internal security user. -
setDisplayUser
-
getCurrentRole
-
setCurrentRole
-
getActiveRoles
-
addActiveRole
-
clearActiveRoles
public void clearActiveRoles() -
isSecurityEnabled
public boolean isSecurityEnabled() -
setSecurityEnabled
public void setSecurityEnabled(boolean securityEnabled) -
reset
public void reset() -
setSessionParameter
-
getSessionParameter
-
unsetSessionParameter
-
setSessionVariable
Define, or redefine, the session variable SET names. -
getSessionVariable
A session variable's value, or null when SET never defined one of that name. -
unsetSessionVariable
Forget a session variable UNSET removed. Removing a name no SET defined is silently accepted. -
isSessionVariable
Whether SET defined a session variable of this name. A session PARAMETER is not one: live refuses$TIMEZONEand$QUERY_TAGunless a SET made a variable of that name. -
getAllSessionParameters
-
getAllSessionVariables
Every session variable SET defined, in creation order — what SHOW VARIABLES lists.
-