[
https://issues.apache.org/jira/browse/KNOX-3589?focusedWorklogId=1055957&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1055957
]
ASF GitHub Bot logged work on KNOX-3589:
----------------------------------------
Author: ASF GitHub Bot
Created on: 19/Nov/26 16:02
Start Date: 19/Nov/26 16:02
Worklog Time Spent: 10m
Work Description: handavid commented on code in PR #1528:
URL: https://github.com/apache/knox/pull/1528#discussion_r4631415522
##########
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:
I'll flip it, but `attributeNameMapper` will never be null. If the config is
null/empty then an empty `AttributeNameMapper` will be created.
Issue Time Tracking
-------------------
Worklog Id: (was: 1055957)
Time Spent: 0.5h (was: 20m)
> 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: 0.5h
> 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)