Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

impersonate user in servlet

Avatar

Level 2

Hi,

 
I want to render a content page for a given user. (the user is not logged in and  only userID is available)
 
My approach was to use a servlet which does the following steps
  • login as admin
  • impersonate user (using userID)
  • send redirect
 
It is possible to get a Session object using SlingRepository.loginAdministrative(null)
and I can impersonate the session for the given user with session.impersonate(credentials)
but the impersonation is only active in the Session object but we need an impersonate that works like the impersonate CQ provides (eg.  in /useradmin  or /siteadmin)
 
Any help would be appreciated.
 
Thanks.
 
Michael
1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Michael,

You can impersonate & avoid using admin seesion.  Why don;t use SSO & pass userid in cookie or header.

http://dev.day.com/docs/en/cq/current/deploying/single_sign_on.html

Thanks,
Sham

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi Michael,

You can impersonate & avoid using admin seesion.  Why don;t use SSO & pass userid in cookie or header.

http://dev.day.com/docs/en/cq/current/deploying/single_sign_on.html

Thanks,
Sham