public interface Session
The session is created at database, and attached to a JDBC connection to enforce data security. The session state (user, role, and namespace) can be changed after attach. The changes take effect immediately on the current JDBC connection (database session), and are committed to database upon detach from the connection.
| Modifier and Type | Method and Description |
|---|---|
SessionNamespace |
createNamespace(java.lang.String name)
Creates a new namespace for this session.
|
void |
deleteNamespace(java.lang.String namespace)
Removes a namespace from a session.
|
void |
disableRole(Role role)
Disables a role granted to the current user for this session.
|
void |
enableRole(Role role)
Enables a role granted to the current user for this session.
|
java.sql.Connection |
getConnection()
Returns the Oracle JDBC
Connection attached with this session. |
java.lang.String |
getCookie()
Returns the secure session cookie used for this session.
|
java.util.Collection<Role> |
getEnabledRoles()
Returns a collection of all currently enabled roles.
|
java.lang.String |
getId()
Returns the internal session ID generated at server for this session.
|
SessionNamespace |
getNamespace(java.lang.String name)
Returns the specified namespace in the session.
|
java.lang.String |
getUser()
Returns current session's user
|
boolean |
isAnonymous()
Determines if this session user is anonymous.
|
boolean |
isAttached()
Determines if this session is attached to a
Connection. |
boolean |
isRoleEnabled(java.lang.String roleName)
Tests if the specified role is enabled in this user's session.
|
boolean |
isTrusted()
Determins if the current session is in trusted mode.
|
void |
switchUser(java.lang.String targetUser, java.util.Collection<NamespaceValue> namespaceValues)
Changes the session user.
|
void |
switchUserKeepState(java.lang.String targetUser, java.util.Collection<NamespaceValue> namespaceValues)
Changes the session user and retains session state (Namespace).
|
java.lang.String |
toString() |
void switchUser(java.lang.String targetUser,
java.util.Collection<NamespaceValue> namespaceValues)
throws java.sql.SQLException,
AccessDeniedException,
InvalidSessionException,
InvalidXSUserException,
XSException,
NotAttachedException,
InvalidXSNamespaceException
targetUser - a User object initialized based on authenticationnamespaceValues - a list of NamespaceValue objects to be created and changed.AccessDeniedException - the current user does not have the privilege to switch to the target user.XSException - a generic error is detectedjava.sql.SQLException - a JDBC exception is thrownInvalidSessionException - an attempt is made to reference an invalid sessionInvalidXSUserException - XS user specified is invalidNotAttachedException - session not attachedInvalidXSNamespaceException - when an invalid namespace specifiedvoid switchUserKeepState(java.lang.String targetUser,
java.util.Collection<NamespaceValue> namespaceValues)
throws java.sql.SQLException,
AccessDeniedException,
InvalidSessionException,
InvalidXSUserException,
XSException,
NotAttachedException,
InvalidXSNamespaceException
NamespaceValue will be set/created.targetUser - a User object initialized based on authenticationnamespaceValues - a list of NamespaceValue objects to be created and changed.AccessDeniedException - the current user does not have the privilege to switch to the target user.XSException - a generic error is detectedjava.sql.SQLException - a JDBC exception is thrownInvalidSessionException - an attempt is made to reference an invalid sessionInvalidXSUserException - XS user specified is invalidNotAttachedException - session not attachedInvalidXSNamespaceException - when an invalid namespace specifiedjava.util.Collection<Role> getEnabledRoles()
boolean isRoleEnabled(java.lang.String roleName)
throws XSException,
NotAttachedException
roleName - name of role to enableNotAttachedException - session not attachedXSException - generic error is detectedjava.lang.String getCookie()
java.lang.String getId()
boolean isAttached()
Connection.boolean isAnonymous()
java.sql.Connection getConnection()
Connection attached with this session.Connectionvoid enableRole(Role role) throws AccessDeniedException, java.sql.SQLException, XSException, InvalidSessionException, NotAttachedException
AccessDeniedException - the current user does not have the privilege to enable this roleXSException - a generic error is detectedjava.sql.SQLException - a JDBC exception is thrownInvalidSessionException - an attempt is made to reference an invalid sessionNotAttachedException - session not attachedvoid disableRole(Role role) throws AccessDeniedException, java.sql.SQLException, XSException, InvalidSessionException, NotAttachedException
AccessDeniedException - the current user does not have the privilege to disable this roleXSException - a generic error is detectedjava.sql.SQLException - a JDBC exception is thrownInvalidSessionException - an attempt is made to reference an invalid sessionNotAttachedException - session not attachedSessionNamespace createNamespace(java.lang.String name) throws java.sql.SQLException, AccessDeniedException, XSException, InvalidXSNamespaceException, InvalidSessionException, NotAttachedException
name - the name of the session namespace. The user should have "bindNamespace" privilege on the namespace template documents corersponding to the name.SessionNamespace that is createdAccessDeniedException - user does not have the privilege to create the namespaceXSException - a generic error is detectedjava.sql.SQLException - a JDBC exception is thrownInvalidXSNamespaceException - namespace already existsInvalidSessionException - an attempt is made to reference an invalid sessionNotAttachedException - session not attachedSessionNamespace getNamespace(java.lang.String name) throws java.sql.SQLException, AccessDeniedException, XSException, InvalidSessionException, InvalidXSNamespaceException, NotAttachedException
name - the namespace to getAccessDeniedException - the current user does not have the privilege to get namespaceXSException - a generic error is detectedjava.sql.SQLException - a JDBC exception is thrownInvalidXSNamespaceException - namespace already existsInvalidSessionException - attempt to reference an invalid sessionNotAttachedException - session not attachedvoid deleteNamespace(java.lang.String namespace)
throws java.sql.SQLException,
AccessDeniedException,
XSException,
InvalidXSNamespaceException,
InvalidSessionException,
NotAttachedException
namespace - the namespace object to be removedAccessDeniedException - the current user does not have the privilege to delete this namespacejava.sql.SQLException - a JDBC exception is thrownInvalidXSNamespaceException - namespace is invalidInvalidSessionException - attempted to reference an invalid sessionNotAttachedException - session not attachedXSException - a generic error is detectedboolean isTrusted()
java.lang.String getUser()
java.lang.String toString()
toString in class java.lang.Object