User Redirection on Login | Community
Skip to main content
Tuhin_Ghosh
Level 8
September 19, 2016
Solved

User Redirection on Login

  • September 19, 2016
  • 15 replies
  • 7074 views

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.
Best answer by smacdonald2008

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

15 replies

smacdonald2008
Level 10
September 20, 2016

That sounds like a good use case - i think you are correct - you would need a custom handler for this. I will check tomorrow (Tues USA Time) to see if anyone has implemented this. 

Tuhin_Ghosh
Level 8
September 20, 2016

Thanks Scott for the quick reply. That would really be helpful if we could get some implementation to start with and build from.

 

Thank and Regards,

Tuhin

Tuhin_Ghosh
Level 8
September 22, 2016

Hi Scott/Community,

 

Did you get any chance to take a look into this ?

 

Thanks and Regards,

Tuhin

Tuhin_Ghosh
Level 8
September 27, 2016

Hi Scott/Members,

Did anyone find anything relevant to this problem statement?

Thanks

Tuhin

kautuk_sahni
Community Manager
Community Manager
September 27, 2016

I will forward this to Scott

~kautuk

Kautuk Sahni
smacdonald2008
Level 10
September 27, 2016

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

smacdonald2008
smacdonald2008Accepted solution
Level 10
September 27, 2016

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

Tuhin_Ghosh
Level 8
September 28, 2016

Thanks Kautuk :)

Tuhin_Ghosh
Level 8
September 28, 2016

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

Tuhin_Ghosh
Level 8
October 17, 2016

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