Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

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