0

I need to get current jackrabbit/session user when a request filter does filter. I've implemented filter class as my past question

Community
  • 1
  • 1
Babak Behzadi
  • 1,236
  • 2
  • 16
  • 33

1 Answers1

1

From your previous question I assume you are using Apache Sling - if you follow my advice there and use a Sling-aware Filter, you can cast the request to SlingHttpServletRequest in the filter's doFilter(...) method.

The SlingHttpServletRequest's getResource() method then provides the current Resource, which you can adapt to a JCR Session which then provides the Jackrabbit user.

Something like (without any checks for the example)

((SlingHttpServletRequest)request).getResource().getResourceResolver().adaptTo(Session.class)...
Community
  • 1
  • 1
Bertrand Delacretaz
  • 6,100
  • 19
  • 24