ACE Director Alum Daniel Morgan, founder of Morgan's Library, is scheduling
complimentary technical Workshops on Database Security for the first 30
Oracle Database customers located anywhere in North America, EMEA, LATAM, or
APAC that send an email to
asra_us@oracle.com. Request a Workshop for
your organization today.
Purpose
Real Application Security
AUTHID
CURRENT_USER
Constants
Name
Data Type
Value
Defined operation codes passed into namespace event handling functions
attribute_first_read_operation
INTEGER
1
modify_attribute_operation
INTEGER
2
Bit values that identify events of interest for a particular attribute in a namespace that has an event handling function
attribute_first_read_event
INTEGER
1
modify_attribute_event
INTEGER
2
Define return codes that can be returned by a namespace event handling function
event_handling_succeeded
INTEGER
0
event_handling_failed
INTEGER
1
The following constants are used as input into the add/delete/enable_global_callback procedure
create_session_event
PLS_INTEGER
1
attach_session_event
PLS_INTEGER
2
guest_to_user_event
PLS_INTEGER
3
proxy_to_user_event
PLS_INTEGER
4
revert_to_user_event
INTEGER
5
enable_role_event
INTEGER
6
disable_role_event
INTEGER
7
enable_dynamic_role_event
INTEGER
8
disable_dynamic_role_event
INTEGER
9
detach_session_event
INTEGER
10
terminate_session_event
PLS_INTEGER
11
direct_login_event
PLS_INTEGER
12
direct_logoff_event
PLS_INTEGER
13
Dependencies
DBMS_XS_NSATTR
DBMS_XS_SESSIONS_FFI
XS$LIST
DBMS_XS_NSATTRLIST
PLITBLM
XS$NAME_LIST
Documented
Yes
Exceptions
Error Code
Reason
ORA-46094
XS user not effective
ORA-46210
Source user is not anonymous in user assignment operation
First Available
12cR1
Security Model
Owned by SYS with EXECUTE granted to PUBLIC
For attaching to a RAS session, the executing user requires ATTACH_SESSION privilege. If dynamic roles are specified ADMINISTER_SESSION privilege is required.
If namespaces are specified, appropriate privilege (MODIFY_NAMESPACE, MODIFY_ATTRIBUTE) on the namespaces or ADMIN_ANY_NAMESPACE system privilege is required.
Registers a PL/SQL procedure as the event handler with the session operation specified by the event_type parameter
dbms_xs_sessions.add_global_callback(
event_type IN PLS_INTEGER,
callback_schema IN VARCHAR2,
callback_package IN VARCHAR2,
callback_procedure IN VARCHAR2);
conn sys@pdbdev as sysdba
CREATE OR REPLACE PACKAGE sec_mgr.sess_pkg AUTHID CURRENT_USER AS
PROCEDURE logoff_proc;
END sess_pkg;
/
CREATE OR REPLACE PACKAGE BODY sec_mgr.sess_pkg AS
PROCEDURE logoff_proc IS
BEGIN
NULL;
END logoff_proc;
END sess_pkg;
/
Assigns a named application user to the currently attached anonymous application session
dbms_xs_sessions.assign_user(
username IN VARCHAR2,
is_external IN BOOLEAN DEFAULT FALSE,
enable_dynamic_roles IN xs$name_list DEFAULT NULL,
disable_dynamic_roles IN xs$name_list DEFAULT NULL,
external_roles xs$name_list DEFAULT NULL,
authentication_time IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
namespaces IN dbms_xs_nsattrlist DEFAULT NULL,);
Attach to an already created RAS session specified by the sessionid
dbms_xs_sessions.attach_session(
sessionid IN RAW,
enable_dynamic_roles IN xs$name_list DEFAULT NULL,
disable_dynamic_roles IN xs$name_list DEFAULT NULL,
external_roles IN xs$name_list DEFAULT NULL,
authentication_time IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
namespaces IN dbms_xs_nsattrlist DEFAULT NULL);
Creates a new custom attribute in the specified namespace in the currently attached application session
dbms_xs_sessions.create_attribute(
namespace IN VARCHAR2,
attribute IN VARCHAR2,
value IN VARCHAR2 DEFAULT NULL,
eventreg IN PLS_INTEGER DEFAULT NULL);
BEGIN
dbms_xs_sessions.dbms_xs_sessions.create_attribute('UWNS', 'item_type', 'generic');
dbms_xs_sessions.dbms_xs_sessions.delete_attribute('UWNS', 'item_type');
END;
/
Create a RAS session with specified 128 char case sensitive username string
dbms_xs_sessions.create_session(
username IN VARCHAR2,
sessionid OUT NOCOPY RAW,
is_external IN BOOLEAN DEFAULT FALSE,
is_trusted IN BOOLEAN DEFAULT FALSE,
namespaces IN dbms_xs_nsattrlist DEFAULT NULL,
cookie IN VARCHAR2 DEFAULT NULL);
Deletes the global callback procedure for the session event specified by event_type
dbms_xs_sessions.delete_global_callback(
event_type IN PLS_INTEGER,
callback_schema IN VARCHAR2 DEFAULT NULL,
callback_package IN VARCHAR2 DEFAULT NULL,
callback_procedure IN VARCHAR2 DEFAULT NULL);
Enables or disables the global callback for the session event specified by event_type
dbms_xs_sessions.enable_global_callback(
event_type IN PLS_INTEGER,
enable IN BOOLEAN DEFAULT TRUE,
callback_schema IN VARCHAR2 DEFAULT NULL,
callback_package IN VARCHAR2 DEFAULT NULL,
callback_procedure IN VARCHAR2 DEFAULT NULL);
Updates the last authentication time for the specified session ID as the current time. Applications must call this procedure when it has reauthenticated an application user.
dbms_xs_sessions.reauth_session(sessionid IN RAW DEFAULT NULL);
Sets the inactivity timeout (in minutes) for the session which is the maximum period of inactivity allowed before the session can be terminated and resource be reclaimed
dbms_xs_sessions.set_inactivity_timeout(
time IN NUMBER,
sessionid IN RAW DEFAULT NULL);