in src/main/java/org/apache/sling/feature/cpconverter/accesscontrol/Mapping.java [48:81]
public Mapping(@NotNull final String spec, boolean enforceMappingByPrincipal) {
final int colon = spec.indexOf(':');
final int equals = spec.indexOf('=');
if (colon == 0 || equals <= 0) {
throw new IllegalArgumentException("serviceName is required");
} else if (equals == spec.length() - 1) {
throw new IllegalArgumentException("userName or principalNames is required");
} else if (colon + 1 == equals) {
throw new IllegalArgumentException("serviceInfo must not be empty");
}
if (colon < 0 || colon > equals) {
this.serviceName = spec.substring(0, equals);
this.subServiceName = null;
} else {
this.serviceName = spec.substring(0, colon);
this.subServiceName = spec.substring(colon + 1, equals);
}
String s = spec.substring(equals + 1);
if (s.charAt(0) == '[' && s.charAt(s.length()-1) == ']') {
this.userName = null;
this.principalNames = extractPrincipalNames(s);
} else if (enforceMappingByPrincipal) {
this.userName = null;
this.principalNames = Collections.singleton(s);
logger.info("Enforcing service mapping by principal name for '{}'", spec);
} else {
this.userName = s;
this.principalNames = null;
}
}