CALLBACK Procedure

This procedure is the landing resource for external login pages. Call this procedure directly from the browser.

Syntax

APEX_AUTHENTICATION.CALLBACK ( 
    p_session_id IN NUMBER, 
    p_app_id IN NUMBER, 
    p_ajax_identifier IN VARCHAR2, 
    p_x01 IN VARCHAR2 DEFAULT NULL, 
    p_x02 IN VARCHAR2 DEFAULT NULL, 
    p_x03 IN VARCHAR2 DEFAULT NULL, 
    p_x04 IN VARCHAR2 DEFAULT NULL, 
    p_x05 IN VARCHAR2 DEFAULT NULL, 
    p_x06 IN VARCHAR2 DEFAULT NULL, 
    p_x07 IN VARCHAR2 DEFAULT NULL, 
    p_x08 IN VARCHAR2 DEFAULT NULL, 
    p_x09 IN VARCHAR2 DEFAULT NULL, 
    p_x10 IN VARCHAR2 DEFAULT NULL ); 

Parameters

Table 3-1 describes the parameters available in CALLBACK procedure.


Table 3-1 APEX_AUTHENTICATION.CALLBACK Procedure Parameters

Parameters Description

p_session_id

The Application Express session identifier.

p_app_id

The database application identifier.

p_ajax_identifierp

The system generated AJAX identifier. See "GET_AJAX_IDENTIFIER Function".

p_x01 through p_x10

Optional parameters that the external login passes to the authentication plugin.


Example 1

In this example, a redirect is performed to an external login page and the callback is passed into Application Express, which the external login redirects to after successful authentication.

declare 
    l_callback varchar2(4000) := apex_application.get_callback_url; 
begin 
    sys.owa_util.redirect_url( 
        'https://single-signon.example.com/my_custom_sso.login?p_on_success='|| 
        sys.utl_url.escape ( 
            url => l_callback, 
            escape_reserved_chars => true ); 
    apex_application.stop_apex_engine; 
end; 

Example 2

In this example, an external login page saves user data in a shared table and performs a call back with a handle to the data. In Application Express, the callback activates the authentication plugin's ajax code. It can take the value of x01 and fetch the actual user data from the shared table.

---- create or replace package body my_custom_sso as 
procedure login ( 
    p_on_success in varchar2 ) 
    is 
    l_login_id varchar2(32); 
begin 
    l_login_id := rawtohex(sys.dbms_crypto.random(32)); 
    insert into login_data(id, username) values (l_login_id, 'JOE USER'); 
    sys.owa_util.redirect_url ( 
    p_on_success||'&p_x01='||l_login_id ); 
end; 
---- end my_custom_sso;