User Redirection on Login | Community
Skip to main content
Tuhin_Ghosh
Level 8
Sep 19, 2016 11:53 PM UTC
Solved

User Redirection on Login

Good Morning Community,

I have to redirect different user to different pages after login based on their profile, such as User A would be landed on /content/project/product/path1 and User B would be landed on /content/project/product/path2

Have anyone implemented something like this?
  
Now what I understand from this is we might need to override authentication handler for this, correct? I am also was thinking how the session would be managed? Like if user A logs in and then closes the browser and then again come back and hit the website he should be taken to the desired home page, would this be taken care by the OOTB AEM functionality or we need to write custom code for the same. I have not much experience on working with Login Module. So please bare with me if I have asked some silly questions.

Thanks and Regards,
Tuhin

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
smacdonald2008
smacdonald2008Accepted solution
Level 10
Sep 27, 2016 1:25 PM UTC

I got this reply from Eng: 

They could look at creating a universal authentication handler hook [1] should be a universal.

https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/bundle/src/main/java/com/adobe/acs/samples/authentication/impl/SampleLoginHookAuthenticationHandler.java

16 replies

jorgwel
New Participant
Jan 11, 2018 7:52 PM UTC

Thank you smacdonald2008​ and Tuhin Ghosh​!

Translate
smacdonald2008
Level 10
Jan 10, 2018 10:26 PM UTC

My Link is based on a new AEM 6.3 article written last summer that shows how to write a login component for the AEM example Toy Store site.  It includes a redirect.

Translate
Tuhin_Ghosh
Level 8
Jan 10, 2018 10:23 PM UTC

HI Jorgwel,

Its quit old now and I have to dig in a bit at the old code. And my login page was always same, it was after the authentication they ought to be redirected to the different landing pages based on their profile. Kindly let me know if this is what you're trying to achieve.

Try to look at Scott's link and see if that helps, otherwise please elaborate your problem a bit further so that the community can understand the problem well and give you a proper resolution.

Thanks

Tuhin

Translate
New Participant
Sep 12, 2022 9:20 AM UTC

Hi @tuhin_ghosh i want to redirect to desired home page, when user just hit the domain only not any homepage path  based on user profile after saml login. Is there a way to archive it? 

Translate
smacdonald2008
Level 10
Jan 10, 2018 9:27 PM UTC

This thread is 2 years old - if you want to learn how to redirect users after a successful login - see this article - where a login component is developed: Creating a Login Component for the Experience Manager Toy Store

Translate
jorgwel
New Participant
Jan 10, 2018 9:21 PM UTC

Tuhin Ghosh​, could you comment a little bit about the needed changes to not redirect always to login page?

Translate
Tuhin_Ghosh
Level 8
Oct 17, 2016 1:11 AM UTC

Hi Scott,

 

It worked for me after adding some custom logic. Thanks a ton for helping out. Also pass on my thanks to the engineering team.

 

Regards,

Tuhin

Translate
Tuhin_Ghosh
Level 8
Sep 28, 2016 12:56 AM UTC

Hi Scott,

 

Thanks for the reply. A helpx article would be very much helpful regarding this problem statement.

I have looked into the github code that you have shared. With this code I am able to see that every time a page is requested this class is getting called. 

After some small changes I am able to redirect the user to a particular page from the code. But the problem is since this class is getting called every time no matter what page i click, its getting redirected to the same page. I  am not able to access any other page than the login page even after log in if I am doing a deferredRedirectResponse.sendRedirect("/content/tuhin/home/path1.html");

I am doing the sendRedirect from the authenticationSucceeded method, just before releaseRedirect mehtod call. Please let me know if I am doing anything wrong.

Thanks and Regards,

Tuhin

Translate
Tuhin_Ghosh
Level 8
Sep 28, 2016 12:50 AM UTC

Thanks Kautuk :)

Translate
smacdonald2008
smacdonald2008Accepted solution
Level 10
Sep 27, 2016 1:25 PM UTC

I got this reply from Eng: 

They could look at creating a universal authentication handler hook [1] should be a universal.

https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/bundle/src/main/java/com/adobe/acs/samples/authentication/impl/SampleLoginHookAuthenticationHandler.java

Translate
smacdonald2008
Level 10
Sep 27, 2016 1:16 PM UTC

I am still looking for an example - i want to write this up as a HELPX. 

Translate