sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1775261 - in /sling/trunk/bundles/servlets/resolver/src: main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java test/java/org/apache/sling/servlets/resolver/internal/SlingServletResolverTest.java
Date Tue, 20 Dec 2016 11:15:53 GMT
Author: cziegeler
Date: Tue Dec 20 11:15:53 2016
New Revision: 1775261

URL: http://svn.apache.org/viewvc?rev=1775261&view=rev
Log:
SLING-5237 : Remove getAdministrativeResourceResolver() usage from org.apache.sling.servlets.resolver

Modified:
    sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
    sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/SlingServletResolverTest.java

Modified: sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java?rev=1775261&r1=1775260&r2=1775261&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
Tue Dec 20 11:15:53 2016
@@ -139,9 +139,6 @@ public class SlingServletResolver
     @Property(value=DEFAULT_SERVLET_ROOT)
     public static final String PROP_SERVLET_ROOT = "servletresolver.servletRoot";
 
-    @Property
-    public static final String PROP_SCRIPT_USER = "servletresolver.scriptUser";
-
     @Property(intValue=DEFAULT_CACHE_SIZE)
     public static final String PROP_CACHE_SIZE = "servletresolver.cacheSize";
 
@@ -771,16 +768,6 @@ public class SlingServletResolver
         }
     }
 
-    private Map<String, Object> createAuthenticationInfo(final Dictionary<String,
Object> props) {
-        final Map<String, Object> authInfo = new HashMap<String, Object>();
-        // if a script user is configured we use this user to read the scripts
-        final String scriptUser = PropertiesUtil.toString(props.get(PROP_SCRIPT_USER), null);
-        if (scriptUser != null && scriptUser.length() > 0) {
-            authInfo.put(ResourceResolverFactory.USER_IMPERSONATION, scriptUser);
-        }
-        return authInfo;
-    }
-
     // ---------- SCR Integration ----------------------------------------------
 
     /**
@@ -802,7 +789,7 @@ public class SlingServletResolver
             pendingServlets.clear();
 
             this.sharedScriptResolver =
-                    resourceResolverFactory.getAdministrativeResourceResolver(this.createAuthenticationInfo(context.getProperties()));
+                    resourceResolverFactory.getServiceResourceResolver(Collections.singletonMap(ResourceResolverFactory.SUBSERVICE,
(Object)"scripts"));
             this.searchPaths = this.sharedScriptResolver.getSearchPath();
             servletResourceProviderFactory = new ServletResourceProviderFactory(servletRoot,
this.searchPaths);
 
@@ -1177,7 +1164,7 @@ public class SlingServletResolver
 
             ResourceResolver resourceResolver = null;
             try {
-                resourceResolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
+                resourceResolver = resourceResolverFactory.getServiceResourceResolver(Collections.singletonMap(ResourceResolverFactory.SUBSERVICE,
(Object)"scripts"));
 
                 final PrintWriter pw = response.getWriter();
 

Modified: sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/SlingServletResolverTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/SlingServletResolverTest.java?rev=1775261&r1=1775260&r2=1775261&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/SlingServletResolverTest.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/SlingServletResolverTest.java
Tue Dec 20 11:15:53 2016
@@ -121,8 +121,7 @@ public class SlingServletResolverTest {
             @Override
             public ResourceResolver getServiceResourceResolver(Map<String, Object>
authenticationInfo)
                     throws LoginException {
-                // TODO Auto-generated method stub
-                return null;
+                return mockResourceResolver;
             }
 
             @Override



Mime
View raw message