Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apex how to login to another application from link in one application?

I have two applications in my workspace, APP 1 and APP 2.

In my case, user will log in to APP 1. from there, i put a menu(or a link) to APP 2. however APP 2 requires authentication. So it will take me to a login page. i would like to eliminate that and get the current user's credentials on APP 1 and login to APP 2.

i'm looking for a simple straightforward method (but need to consider security) to login to APP 2.

what i could think of is apex_collection..i could store credentials n use it to create a login process for APP 2. however apex_collection is session based. eventhough i've set session for APP 2, it still wont read values from my apex_collection.

Does anyone have a suggestion or a solution?

like image 688
Psychocryo Avatar asked Mar 21 '23 00:03

Psychocryo


2 Answers

All you need to do is use the same authentication scheme in both applications and set the cookie name attribute to the same value in both authentication schemes like this:

Session Cookie Attributes

APEX will then use the same session across the two applications and the user will not have to log in again when they navigate from one to the other, provided of course that you pass the SESSION_ID in the URL.

like image 189
Tony Andrews Avatar answered Mar 22 '23 15:03

Tony Andrews


A Few Comments on Default APEX Workspace Authentication Security

It may also be helpful to expand on an explanation of why the solution posted by @TonyAndrews works.

For any Apex Apps within the same workspace, if they use the default "APEX Application Authentication" method, they will consult the same authentication user list... so USER1 and its password is a valid login for any of the "neighboring" applications...

This may be a concern if you are hosting different clients or users that should not be intermingling with the other applications. You can also define user GROUPS in the same place as you set up each workspace user. Each application can have its own security filter that permits access by membership of BOTH user/password authentication AND membership in the appropriate access group.

Sharing workspaces may also be a problem because of the unique user name restriction of a single workspace. You can get around that by:

  • Defining different name-spaces for each application:

    1. Email addresses are good: "[email protected]"
    2. An app id prefix such as: SHOP_EDNA, SHOP_GARRETT, TC_KAREN, TC_MARLOWE, MY_BORIS etc.
    3. Different name styles: first name only, first name + last initial, etc.
  • To keep things simple, you can always just spin up a brand new workspace: a warning however is that common user names like `ADMIN` are NOT the same between separate workspaces. There shouldn't be much concern however because apps or workspace users may have the same or different schema access privileges to the database back end.

A Word of Caution to Administrators and Developers:

When you go live with an application or multiple applications on a user-facing system, keep in mind the deployment destination (i.e., the workspace) and what else is sharing that workspace. There are some real situations where apps are not intended to be shared or accessed by other "inside" users. Be sure to read up and understand the security constraints and methods of using Default Apex Authentication security so that it's more than luck that protects your own production/live deployed applications.

like image 30
Richard Pascual Avatar answered Mar 22 '23 15:03

Richard Pascual