Author: kwin
Date: Wed Apr 26 14:18:16 2017
New Revision: 1792749

URL: http://svn.apache.org/viewvc?rev=1792749&view=rev
Log:
SLING-4312 document ServiceUserMapped service

Modified:
    
sling/site/trunk/content/documentation/the-sling-engine/service-authentication.mdtext

Modified: 
sling/site/trunk/content/documentation/the-sling-engine/service-authentication.mdtext
URL: 
http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/the-sling-engine/service-authentication.mdtext?rev=1792749&r1=1792748&r2=1792749&view=diff
==============================================================================
--- 
sling/site/trunk/content/documentation/the-sling-engine/service-authentication.mdtext
 (original)
+++ 
sling/site/trunk/content/documentation/the-sling-engine/service-authentication.mdtext
 Wed Apr 26 14:18:16 2017
@@ -158,7 +158,18 @@ This is configured through an OSGi confi
 
     <service-name>[:<subservice-name>]=<authorizable id of a JCR system user>]
 
-The according user must exist at the point in time where 
`ResourceResolverFactory.getServiceResourceResolver(...)` or 
`SlingRepository.loginService(...)` is called.
+The according user must exist at the point in time where 
`ResourceResolverFactory.getServiceResourceResolver(...)` or 
`SlingRepository.loginService(...)` is called. If you rely on one of those 
methods in your `activate` method of an OSGi component you should make sure 
that you defer starting your OSGi component until the according service user 
mapping is in place. For that you can reference the OSGi service 
`ServiceUserMapped` 
([SLING-4312](https://issues.apache.org/jira/browse/SLING-4312)), optionally 
with a target filter on property `subServiceName` (in case such a subservice 
name is used). The service `ServiceUserMapped` does not expose any methods but 
is only a marker interface exclusively used to defer starting of other OSGi 
components.
+
+Example OSGi DS Component
+
+    :::java
+    @Component
+    class MyComponent {
+      // this waits with the activation of this component until a service user 
mapping with the service name = current bundle's id and the sub service name 
'my-subservice-name' is available.
+      // you can leave out "target" if the sub service name is not used
+      @Reference(target = "(subServiceName=my-subservice-name)")
+      private ServiceUserMapped serviceUserMapped;
+    }
 
 ## Deprecation of administrative authentication
 


Reply via email to