[ 
https://issues.apache.org/jira/browse/SLING-3854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14098502#comment-14098502
 ] 

Felix Meschberger commented on SLING-3854:
------------------------------------------

[~anchela] Thank you very much.

>From an implementation perspective I think we have to add a user validation 
>method to the {{getServiceUserID}} method implementation. This method must be 
>called for each call of {{getServiceUserID}} because the named user may become 
>a regular user between calls.

{code}
Index: 
src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
===================================================================
--- 
src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
   (Revision 1562756)
+++ 
src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
   (Arbeitskopie)
@@ -94,7 +94,13 @@
      */
     public String getServiceUserID(final Bundle bundle, final String 
subServiceName) {
         final String serviceName = bundle.getSymbolicName();
+        final String userName = getServiceUserIDInternal(serviceName, 
subServiceName);
+        return validateUser(userName) ? userName : null;
+    }
 
+
+    private String getServiceUserIDInternal(final String serviceName, final 
String subServiceName) {
+
         // try with serviceInfo first
         for (Mapping mapping : this.serviceUserMappings) {
             final String user = mapping.map(serviceName, subServiceName);
@@ -114,4 +120,9 @@
         // finally, fall back to default user
         return this.defaultUser;
     }
+
+    private boolean validateUser(final String userName) {
+        // TODO: Implement user validation, e.g. SLING-3854
+        return true;
+    }
 }
{code}

> Add configuration option to restrict service user mapper to system users
> ------------------------------------------------------------------------
>
>                 Key: SLING-3854
>                 URL: https://issues.apache.org/jira/browse/SLING-3854
>             Project: Sling
>          Issue Type: Improvement
>          Components: Service User Mapper
>            Reporter: angela
>
> JCR-3802 introduces the concept of system users that distinct from regular 
> user accounts and never have a password set. the API extensions include to 
> following ability to discover if a given User is actually a system user: 
> {{User.isSystemUser}}.
> It would be good if the service user mapping had a configuration option that 
> would restrict the mapping to dedicated service users i.e. to users which are 
> defined to be system users in case sling is running on a JCR repository that 
> implements jackrabbit API.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to