Interface Session


  • public interface Session
    This interface represents an application security context that encapsulates user, role, and namespace.

    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.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method 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()