Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Service User Mapper 1.3.4
-
None
Description
kpauls If I am not mistaken there is an extra lookup in the following method:
private Iterable<String> internalGetPrincipalNames(final String serviceName, final String subServiceName) { log.debug( "internalGetPrincipalNames: {} active mappings, looking for mapping for {}/{}", new Object[] { this.activeMappings.length, serviceName, subServiceName }); for (final Mapping mapping : this.activeMappings) { final Iterable<String> principalNames = mapping.mapPrincipals(serviceName, subServiceName); if (principalNames != null) { log.debug("Got principalNames [{}] from {}/{}", new Object[] {principalNames, serviceName, subServiceName }); return principalNames; } } for (Mapping mapping : this.activeMappings) { final Iterable<String> principalNames = mapping.mapPrincipals(serviceName, null); if (principalNames != null) { log.debug("Got principalNames [{}] from {}/{}", new Object[] {principalNames, serviceName }); return principalNames; } } // second round without serviceInfo log.debug( "internalGetPrincipalNames: {} active mappings, looking for mapping for {}/<no subServiceName>", this.activeMappings.length, serviceName); for (Mapping mapping : this.activeMappings) { final Iterable<String> principalNames = mapping.mapPrincipals(serviceName, null); if (principalNames != null) { log.debug("Got principalNames [{}] from {}/<no subServiceName>", principalNames, serviceName); return principalNames; } } log.debug("internalGetPrincipalNames: no mapping found."); return null; }
If I read the code properly the lookup that is logged by being the 'second round' is actually the third perform once again the lookup without 'subServiceName'. If that is correct I would suggest to remove the following code:
for (Mapping mapping : this.activeMappings) { final Iterable<String> principalNames = mapping.mapPrincipals(serviceName, null); if (principalNames != null) { log.debug("Got principalNames [{}] from {}/{}", new Object[] {principalNames, serviceName }); return principalNames; } }
or the third one that is called the second round
But please double check to make sure I didn't just overlook some subtle diff