SET_AUTHENTICATION_RESULT Procedure

This procedure can be called from an application's custom authentication function (that is, credentials verification function). The status passed to this procedure is logged in the Login Access Log.

Syntax

APEX_UTIL.SET_AUTHENTICATION_RESULT(
    p_code IN NUMBER
    );

Parameters

Table: EXPIRE_WORKSPACE_ACCOUNT Parameters describes the parameters available in the SET_AUTHENTICATION_RESULT procedure.

SET_AUTHENTICATION_RESULT Parameters

Parameter Description

p_code

Any numeric value the developer chooses. After this value is set in the session using this procedure, it can be retrieved using the APEX_UTIL.GET_AUTHENTICATION_RESULT function.


Example

One way to use this procedure is to include it in the application authentication scheme. This example demonstrates how text and numeric status values can be registered for logging. In this example, no credentials verification is performed, it just demonstrates how text and numeric status values can be registered for logging.

Note that the status set using this procedure is visible in the apex_user_access_log view and in the reports on this view available to workspace and site administrators.

CREATE OR REPLACE FUNCTION MY_AUTH(p_username IN VARCHAR2, 
p_password IN VARCHAR2)
RETURN BOOLEAN
IS
BEGIN
  APEX_UTIL.SET_CUSTOM_AUTH_STATUS(p_status=>'User: 
'||p_username||' is back.');
  IF UPPER(p_username) = 'GOOD' THEN
    APEX_UTIL.SET_AUTHENTICATION_RESULT(24567);
    RETURN TRUE;
ELSE
    APEX_UTIL.SET_AUTHENTICATION_RESULT(-666);
      RETURN FALSE;
  END IF;
END;