Let's look at generic request processing of Sling: Sling is linked into the outside world by registering the Sling Main Servlet – implemented by the 
SlingMainServlet class in the Sling Engine bundle – with an OSGi HttpService. This registration is accompanyied with an implementation instance of the OSGi HttpContext interface, which defines a method to authenticate requests: handleSecurity.
This method is called by the OSGi HTTP Service implementation after the servlet has been selected to handle the request but before actually calling the servlet's 
service method.- First the OSGi HTTP Service implementation is analyzing the request URL to find a match for a servlet or resource registered with the HTTP Service.
- Now the HTTP Service implementation has to call the handleSecuritymethod of theHttpContextobject with which the servlet or resource has been registered. This method returnstrueif the request should be serviced. If this method returnsfalsethe HTTP Service implementation terminates the request sending back any response which has been prepared by thehandleSecuritymethod. Note, that thehandleSecuritymethod must prepare the failure response sent to the client, the HTTP Service adds nothing here. If thehandleSecuritymethod is successful, it must add two (or three) request attributes described below.
- When the handleSecuritymethod returnstruethe HTTP Service either calls theServlet.servicemethod or sends back the requested resource depending on whether a servlet or a resource has been selected in the first step. {column} {section}
The important thing to note here is, that at the time the 
handleSecurity method is called, the SlingMainServlet is not yet in control of the request. So any functionality added by the SlingMainServlet, notably the SlingHttpServletRequest and SlingHttpServletResponse objects are not available to the implementation of the handleSecurity method.Deprecation of administrative authentication
Originally the 
ResourceResolverFactory.getAdministrativeResourceResolver and SlingRepository.loginAdministrative methods have been defined to provide access to the resource tree and JCR Repository. These methods proved to be inappropriate because they allow for much too broad access.
Consequently these methods are being deprecated and will be removed in future releases of the service implementations.
The following methods are deprecated:
- ResourceResolverFactory.getAdministrativeResourceResolver
- ResourceProviderFactory.getAdministrativeResourceProvider
- SlingRepository.loginAdministrative

