Override login-token path in AEM
Hi,
I have been working on a requirement where an AEM instance should support multiple SAML connections for different parts of same site. Since, these different parts of site are mutually exclusive, setting up SAML configurations is not a problem and works fine for authenticating a user.
Following is the structure of the site:
- /content/site/parta - protected by IDP SAMLA
- /content/site/partb - protected by IDP SAMLB
However, when authenticated user navigates from parta to partb, user is still considered authenticated as AEM is validating login-token and since it finds an valid login-token, it treats the user as authenticated even though its different saml path at which user has authenticated. We are currently using an awkward workaround by creating a cookie to track where the user has logged in from and when they try to navigate to other part of site, I am forcing user to go thru logout. I can also use CUG by assigning users to different groups when they authenticate with different IDPs and use permission based access. But both of them dont goto IDP login without forcing user to logout at AEM.
I have tried to change the login-token path to say AEM has authenticated on parta and so if user access partb, they will graciously go through SAMLB login flow instead of having to go thru AEM logout. For this, I tried changing login-token path by implementing AuthenticationInfoPostProcessor and also using sling filter. However, changing the path is creating a new cookie instead of updating it as both events are happening after POST /saml_login call from IDP.
Any suggestions as how this can be solved?
Thanks!!