impersonate user in servlet | Community
Skip to main content
Level 1
October 16, 2015
Solved

impersonate user in servlet

  • October 16, 2015
  • 1 reply
  • 809 views

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
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 Sham_HC

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

1 reply

Sham_HC
Sham_HCAccepted solution
Level 10
October 16, 2015

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