Home > Oracle Application Express ... > APEX_CUSTOM_AUTH
You can use the APEX_CUSTOM_AUTH package to perform various operations related to authentication and session management.
This function checks for the existence of page-level item within an application. This function requires the parameter p_item_name. This function returns a Boolean value (true or false).
Syntax
FUNCTION APPLICATION_PAGE_ITEM_EXISTS(
p_item_name IN VARCHAR2)
RETURN BOOLEAN;
This function checks whether the current page's authentication attribute is set to Page Is Public and returns a Boolean value (true or false)
|
See Also: "Editing Page Attributes" and "Security" for information about setting this page attribute |
Syntax
FUNCTION CURRENT_PAGE_IS_PUBLIC RETURN BOOLEAN;
This procedure combines the SET_USER and SET_SESSION_ID procedures to create one call.
Syntax
PROCEDURE DEFINE_USER_SESSION(
p_user IN VARCHAR2)
p_session_id IN NUMBER);
This procedure obtains the properties of the session cookie used in the current authentication scheme for the specified application. These properties can be viewed directly in the Application Builder by viewing the authentication scheme attributes.
Syntax
APEX_CUSTOM_AUTH.GET_COOKIE_PROPS( p_app_id IN NUMBER, p_cookie_name OUT VARCHAR2, p_cookie_path OUT VARCHAR2, p_cookie_domain OUT VARCHAR2);
Parameters
Table: GET_COOKIE_PROPS Parameters describes the parameters available in the GET_COOKIE_PROPS procedure.
GET_COOKIE_PROPS Parameters
| Parameter | Description |
|---|---|
|
|
An application ID in the current workspace. |
|
|
The cookie name. |
|
|
The cookie path. |
|
|
The cookie domain. |
Example
DECLARE
l_cookie_name varchar2(256);
l_cookie_path varchar2(256);
l_cookie_domain varchar2(256);
BEGIN
APEX_CUSTOM_AUTH.GET_COOKIE_PROPS (
p _cookie_name => l_cookie_name,
p _cookie_path => l_cookie_path,
p _cookie_domain => l_cookie_domain);
END;
This procedure obtains the LDAP attributes of the current authentication scheme for the current application. These properties can be viewed directly in Application Builder by viewing the authentication scheme attributes.
Syntax
APEX_CUSTOM_AUTH.GET_LDAP_PROPS( p_ldap_host OUT VARCHAR2, p_ldap_port OUT NUMBER, p_ldap_dn OUT VARCHAR2, p_ldap_edit_function OUT VARCHAR2);
Parameters
Table: GET_LDAP_PROPS Parameters describes the parameters available in the GET_LDAP_PROPS procedure.
GET_LDAP_PROPS Parameters
| Parameter | Description |
|---|---|
|
|
LDAP host name. |
|
|
LDAP port number. |
|
|
LDAP DN string. |
|
|
LDAP edit function name. |
Example
DECLARE
l_ldap_host varchar2(256);
l_ldap_port number;
l_ldap_dn varchar2(256);
l_ldap_edit_function varchar2(256);
BEGIN
APEX_CUSTOM_AUTH.GET_LDAP_PROPS (
p_ldap_host => l_ldap_host,
p_ldap_port => l_ldap_port,
p_ldap_dn => l_ldap_dn,'
p_ldap_edit_function => l_ldap_edit_function);
END;
This function generates the next session ID from the Oracle Application Express sequence generator. This function returns a number.
Syntax
FUNCTION GET_NEXT_SESSION_ID RETURN NUMBER;
This function returns the Oracle Application Express session ID located by the session cookie in the context of a page request in the current browser session.
Syntax
APEX_CUSTOM_AUTH.GET_SESSION_ID_FROM_COOKIE RETURN NUMBER;
Example
DECLARE VAL NUMBER; BEGIN VAL := APEX_CUSTOM_AUTH.GET_SESSION_ID_FROM_COOKIE; END;
This function returns user name registered with the current Oracle Application Express session in the internal sessions table. This user name is usually the same as the authenticated user running the current page.
Syntax
APEX_CUSTOM_AUTH.GET_USERNAME RETURN VARCHAR2;
Example
DECLARE VAL VARCHAR2(256); BEGIN VAL := APEX_CUSTOM_AUTH.GET_USERNAME; END;
This function returns a number with the value of the security group ID that identifies the workspace of the current user.
Syntax
FUNCTION GET_SECURITY_GROUP_ID RETURN NUMBER;
This function returns APEX_APPLICATION.G_INSTANCE global variable. GET_SESSION_ID returns a number.
Syntax
PROCEDURE GET_SESSION_ID RETURN NUMBER;
This function returns the APEX_APPLICATION.G_USER global variable (VARCHAR2).
Syntax
FUNCTION GET_USER RETURN VARCHAR2;
This function is a Boolean result obtained from executing the current application's authentication scheme to determine if a valid session exists. This function returns the Boolean result of the authentication scheme's page sentry.
Syntax
APEX_CUSTOM_AUTH.IS_SESSION_VALID RETURN BOOLEAN;
Example
DECLARE VAL BOOLEAN; BEGIN VAL := APEX_CUSTOM_AUTH.IS_SESSION_VALID; END;
Also referred to as the "Login API," this procedure performs authentication and session registration.
Syntax
APEX_CUSTOM_AUTH.LOGIN( p_uname IN VARCHAR2, p_password IN VARCHAR2, p_session_id IN VARCHAR2, p_app_page IN VARCHAR2, p_entry_point IN VARCHAR2, p_preserve_case IN BOOLEAN);
Parameter
Table: LOGIN Parameters describes the parameters available in the LOGIN procedure.
LOGIN Parameters
| Parameter | Description |
|---|---|
|
|
Login name of the user. |
|
|
Clear text user password. |
|
|
Current Oracle Application Express session ID. |
|
|
Current application ID. After login page separated by a colon (:). |
|
|
Internal use only. |
|
|
If true, do not upper |
Example
BEGIN
APEX_CUSTOM_AUTH.LOGIN (
p_uname => 'FRANK',
p_password => 'secret99',
p_session_id => V('APP_SESSION'),
p_app_page => :APP_ID||':1');
END;
|
Note: :Do not use bind variable notations forp_session_id argument. |
This procedure effects a logout from the current session by unsetting the session cookie and redirecting to a new location.
Syntax
APEX_CUSTOM_AUTH.LOGOUT( p_this_app IN VARCHAR2, p_next_app_page_sess IN VARCHAR2, p_next_url IN VARCHAR2);
Parameter
Table: LOGOUT Parameters describes the parameters available in the LOGOUT procedure.
LOGOUT Parameters
| Parameter | Description |
|---|---|
|
|
Current application ID. |
|
|
Application and page number to redirect to. Separate multiple pages using a colon (:) and optionally followed by a colon (:) and the session ID (if control over the session ID is desired). |
|
|
URL to redirect to (use this instead of |
Example
BEGIN
APEX_CUSTOM_AUTH.LOGOUT (
p_this_app => '1000',
p_next_app_page_sess => '1000:99');
END;
This procedure performs session registration, assuming the authentication step has been completed. It can be called only from within an Oracle Application Express application page context.
Syntax
APEX_CUSTOM_AUTH.POST_LOGIN( p_uname IN VARCHAR2, p_session_id IN VARCHAR2, p_app_page IN VARCHAR2, p_preserve_case IN BOOLEAN);
Parameter
Table: POST_LOGIN Parameters describes the parameters available in the POST_LOGIN procedure.
POST_LOGIN Parameters
| Parameter | Description |
|---|---|
|
|
Login name of user. |
|
|
Current Oracle Application Express session ID. |
|
|
Current application ID and after login page separated by a colon (:). |
|
|
If true, do not include |
Example
BEGIN
APEX_CUSTOM_AUTH.POST_LOGIN (
p_uname => 'FRANK',
p_session_id => V('APP_SESSION'),
p_app_page => :APP_ID||':1');
END;
This function returns a Boolean result based on the global package variable containing the current Oracle Application Express session ID. Returns true if the result is a positive number. returns false if the result is a negative number.
Syntax
FUNCTION SESSION_ID_EXISTS RETURN BOOLEAN;
Example
DECLARE VAL BOOLEAN; BEGIN VAL := APEX_CUSTOM_AUTH.SESSION_ID_EXISTS; END;
This procedure sets the APEX_APPLICATION.G_USER global variable. SET_USER requires the parameter P_USER (VARCHAR2) which defines a user ID.
Syntax
PROCEDURE SET_USER(
p_user IN VARCHAR2)
This procedure sets APEX_APPLICATION.G_INSTANCE global variable. This procedure requires the parameter P_SESSION_ID (NUMBER) which specifies a session ID.
Syntax
PROCEDURE SET_SESSION_ID(
p_session_id IN NUMBER)
This procedure combines the operation of GET_NEXT_SESSION_ID and SET_SESSION_ID in one call.
Syntax
PROCEDURE SET_SESSION_ID_TO_NEXT_VALUE;