smolnar82 commented on code in PR #1528:
URL: https://github.com/apache/knox/pull/1528#discussion_r4631807939
##########
gateway-server/src/main/java/org/apache/knox/gateway/services/ldap/backend/LdapProxyBackend.java:
##########
@@ -811,7 +819,28 @@ private String[] toRemoteAttributes(String[] attributes,
boolean addMemberOf) {
remote.add(remoteUserIdentifierAttribute);
}
- return remote.toArray(new String[0]);
+ return mapRequestedAttributesToRemote(remote.toArray(new String[0]));
+ }
+
+ /**
+ * Translates operator-mapped proxy attribute names in a
requested-attribute list to the remote
+ * server's names, so the remote search asks for the name the server
actually knows (e.g. a
+ * client request for {@code modifyTimestamp} is forwarded as {@code
whenChanged}). Unmapped
+ * names (including {@code "*"}) pass through unchanged, and the array is
only copied when a
+ * mapping is actually configured.
+ *
+ * @param attributes the requested attributes, in proxy-facing names
+ * @return the attributes translated to remote names
+ */
+ String[] mapRequestedAttributesToRemote(String[] attributes) {
+ if (attributeNameMapper.isEmpty() || attributes == null) {
Review Comment:
Yepp; I got it. But the way it was written yield for an NPE...we might have
just missed the null check. Anyway, it's fixed now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]