Problem
There are many methods that are floating around. Unfortunately much of the literature is for extending R12 - and this is fairly straight-forward. I spent a long time trying to find one that worked in 11i.This is one that worked for me. I think it will only work if your EBS and Apex environment are on the same domain, and you will need to check that your system administrator is happy for you to switch off the authorization schemes in favour of working off a session cookie...
Solution
1a. Create a form function and add to a menu. This are the important bits of the function.Type: SSWA plsql function that opens a new window (Kiosk Mode)
Parameters: p_application=INTERFACE_GATEWAY&p_page=HOME
HTML Call: gns_apex.start_application
2. Create a package in EBS. In my case it's gns_apex.start_application.
A procedure passes your session cookie identifier to Apex and opens up your application page.
procedure start_application
(
p_application varchar2,
p_page varchar2,
p_items varchar2 default null,
p_item_values varchar2 default null
)
as
l_session varchar2(32);
l_request varchar2(32);
l_debug varchar2(32);
l_clearcache varchar2(32);
l_printerfriendly varchar2(32);
begin
APEX_UTIL.SET_SESSION_STATE('FSP_AFTER_LOGIN_URL');
OWA_UTIL.mime_header('text/html', FALSE);
select
icx_sec.getsessioncookie into l_session
from dual;
owa_util.redirect_url
(
|| p_application || ':'
|| p_page || ':'
|| l_session || ':'
|| l_request || ':'
|| l_debug || ':'
|| l_clearcache || ':'
|| 'P_SESSION_ID' || ':'
|| l_session || ':'
|| l_printerfriendly
);
end start_application;
end gns_apex;
And then create a procedure which will be called by Apex when first accessed. I messed arounf with a few things - I ended up not needing the parameter for session. Tidy that up if you want.
FUNCTION
check_ebs_credentials (p_session_id in number)
RETURN BOOLEAN
IS
c_ebs VARCHAR2(240) := 'E-Business
Suite';
c_user varchar2(10) := 'APEX_USER';
l_authorized BOOLEAN;
l_user_id NUMBER;
l_resp_id NUMBER;
l_resp_appl_id NUMBER;
l_sec_group_id NUMBER;
l_org_id NUMBER;
l_time_out NUMBER;
l_ebs_url VARCHAR2(100);
l_appl_name VARCHAR2(240);
l_user_name varchar2(100);
CURSOR get_apps_credentials
IS
SELECT iss.user_id
,
iss.responsibility_id
,
iss.responsibility_application_id
,
iss.security_group_id
,
iss.org_id
,
iss.time_out
,
isa.value
FROM
apps.icx_sessions iss
,
apps.icx_session_attributes isa
WHERE iss.session_id =
icx_sec.getsessioncookie--p_session_id
AND
isa.session_id = iss.session_id;
CURSOR get_appl_name (b_appl_id NUMBER)
IS
SELECT application_name
FROM
apps.fnd_application_tl
WHERE
application_id = b_appl_id
AND
language = USERENV('LANG');
cursor c_user_name (b_user_id number)
is
select user_name
from fnd_user
where user_id = b_user_id;
BEGIN
OPEN get_apps_credentials;
FETCH get_apps_credentials
INTO l_user_id
,
l_resp_id
,
l_resp_appl_id
,
l_sec_group_id
,
l_org_id
,
l_time_out
,
l_ebs_url;
IF get_apps_credentials%NOTFOUND
THEN
l_authorized := FALSE;
ELSE
l_authorized := TRUE;
OPEN get_appl_name(l_resp_appl_id);
FETCH get_appl_name INTO l_appl_name;
IF get_appl_name%NOTFOUND THEN
l_appl_name := c_ebs;
END IF;
CLOSE get_appl_name;
OPEN c_user_name(l_user_id);
FETCH c_user_name INTO l_user_name;
IF c_user_name%NOTFOUND THEN
l_user_name := c_USER;
END IF;
CLOSE c_user_name;
apex_util.set_session_state('EBS_USER_ID',TO_CHAR(l_user_id));
apex_util.set_session_state('EBS_RESP_ID',TO_CHAR(l_resp_id));
apex_util.set_session_state('EBS_RESP_APPL_ID',TO_CHAR(l_resp_appl_id));
apex_util.set_session_state('EBS_SEC_GROUP_ID',TO_CHAR(l_sec_group_id));
apex_util.set_session_state('EBS_ORG_ID',TO_CHAR(l_org_id));
apex_util.set_session_state('EBS_TIME_OUT',TO_CHAR(l_time_out));
apex_util.set_session_state('EBS_URL',l_ebs_url);
apex_util.set_session_state('EBS_APPLICATION_NAME',l_appl_name);
apex_util.set_session_state('EBS_USER_NAME',l_user_name);
apex_util.set_session_max_idle_seconds(l_time_out*60,'APPLICATION');
END IF;
CLOSE get_apps_credentials;
RETURN l_authorized;
EXCEPTION
WHEN OTHERS THEN
IF get_apps_credentials%ISOPEN THEN
CLOSE get_apps_credentials; END IF;
RETURN FALSE;
END
2b. In EBS> Security > Web PL/SQL create a new entry for the package that you created.
(In my case it was Name: GNS_APEX ; Type: Package)
3. In Apex: Shared Components > Security > Authentication Schemes
Create a new scheme which will be your current scheme. Choose no authentication.
4. Shared Components > Security > Authorization Schemes
Create a new scheme
BEGIN
RETURN gns_apex.check_ebs_credentials(NULL);
END;
5. Create some variables. It doesn't matter where they are - you'll probably want to hide them or display them on your footer. I think application items would work just as well.
If you note, the "check_ebs_credentials" procedure populates these for you.
6. Shared components > Security Attributes
Make sure that your authentication scheme is set to what you defined in step 3.
Make sure that your authorization scheme is set to the one defined in step 4.
7. Make sure that your application alias is set to the same one that you have defined in your EBS function parameters.
Share components > Application Definition Attributes
8. Your EBS function will take you straight to an Apex page rather than the login page. Make sure that your page alias (the one that you want the user to start with) is set to the same one that you have defined in your EBS function parameters.
Result
Screenshot showing EBS credentials displayed.
Note:
Some of my users are using extremely old browsers so I had to use the Traditional Blue theme rather than the newer universal themes that comes with Apex 5x and have nice features...
Comments
Post a Comment