anchela commented on code in PR #43:
URL: 
https://github.com/apache/sling-org-apache-sling-jcr-resource/pull/43#discussion_r1605249171


##########
src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderStateFactory.java:
##########
@@ -111,7 +111,20 @@ private static Bundle extractCallingBundle(@NotNull 
Map<String, Object> authenti
                     } else {
                         final Object subService = 
authenticationInfo.get(ResourceResolverFactory.SUBSERVICE);
                         final String subServiceName = subService instanceof 
String ? (String) subService : null;
-                        session = repo.loginService(subServiceName, null);
+                        // let's shortcut the impersonation for service users, 
if impersonation was requested
+                        String sudoUser = getSudoUser(authenticationInfo);
+                        if (sudoUser != null) {
+                            SimpleCredentials creds = new 
SimpleCredentials(sudoUser, new char[0]);
+                            
creds.setAttribute(ResourceResolver.USER_IMPERSONATOR, subServiceName == null ?

Review Comment:
   @raducotescu , as discussed in private.... ok with leaving it in since 
apparently the resource-resolver api allows to retrieve the impersonator and 
does so via a session attribute.
   althought that feels a bit awkward to me to use a jcr-session attribute for 
that which by coincidence gets populated from session attributes *autsch*



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to