[
https://issues.apache.org/jira/browse/KNOX-3589?focusedWorklogId=1055963&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1055963
]
ASF GitHub Bot logged work on KNOX-3589:
----------------------------------------
Author: ASF GitHub Bot
Created on: 19/Nov/26 16:30
Start Date: 19/Nov/26 16:30
Worklog Time Spent: 10m
Work Description: 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.
Issue Time Tracking
-------------------
Worklog Id: (was: 1055963)
Time Spent: 40m (was: 0.5h)
> LDAP Proxy maps remote attributes to local attributes
> -----------------------------------------------------
>
> Key: KNOX-3589
> URL: https://issues.apache.org/jira/browse/KNOX-3589
> Project: Apache Knox
> Issue Type: Improvement
> Components: LDAP
> Affects Versions: 3.0.0
> Reporter: David Han
> Assignee: David Han
> Priority: Major
> Fix For: 3.1.0
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Add the ability to map remote attributes into proxy attributes. This feature
> is used to translate non-standard attributes into ApacheDS attributes. For
> example, Active Directory uses "whenChanged" instead of "modifyTimestamp".
> This mapping needs to handle:
> 1. search filters
> 2. requested attributes
> 3. resulting entries
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)