1
votes

We created 5 applications based on same schema and all in one workspace now. Actually, initially they were created on different machines. now, we have to authenticate users from AD and depending on user type, have to allow or deny some modules. i have created one pager application which have 5 buttons and can control rendering of buttons according to user logged in but...the problem is, inside the applications, i have restrictions on some reports for some users...now one way was to do that is to create a log in for every application separately and thus every application would exactly know who is logged in. but that would be impractical as we need single-sign-on kind of functionality. please let me know how to have a single log in page work for all application inside the apex workspace so that every application would know name of the user currently logged in. for the 5 applications, i actually use No_Authentication authentication scheme. and i use following function initially for my one pager application to render the buttons to user or deny

 create or replace function getUserName return varchar2
is
  userName varchar2(20);
  c owa_cookie.cookie;
begin
   c := owa_cookie.get('LOGIN_USERNAME_COOKIE');
   userName := c.vals(1);
  return trim(userName);
  end;

but i cannot user this function obviously in my 5 actual applications.

help is requested please. bundle of thanks in advance.

1
So basically, this is the enhanced question from stackoverflow.com/q/8277483/814048 ? You could've clarified and edited that one.Tom

1 Answers

0
votes

Check my answer here on sharing sessions: apex button to call a page in another application

What you need to do further: give each application an authentication scheme. Your non-authenticated applications need authentication too, you could copy the scheme from your main app and subscribe them to the main one, so any changes on the main would be reflected on the subscribed. Most important: same cookie name in the auth scheme, and pass on the session when you link between applications.

If you want to redirect to your main app for each login that has to be performed, you need to add an application process to the login pages of your 'sub'-apps. Put this in an On Load - Before Header:

htp.init();
owa_util.redirect_url('f?p=main_app:101');  --redirects
apex_application.g_unrecoverable_error := true; --stops processing

This will redirect to the login page of your main application when a user would land on a login page of your sub-applications.

You can also change the logout url of the authentication scheme. You can refer to your main page app for example.

Then you can use :APP_USER in your applications and skip the cookie method, they're the same.