Thursday, June 13, 2013

How to impersonate the seesion in the workflow?

Here is the piece of code to impersonate the session:

@Reference
SlingRepository repo;

Session adminSession = repo.loginAdministrative(null);
Session userSession = adminSession.impersonate (new SimpleCredentials("<userId>",new char[0]));

          log.debug(“Session is: {}”, userSession.getUserID());

No comments:

Post a Comment