[ 
https://issues.apache.org/jira/browse/KNOX-3589?focusedWorklogId=1055954&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1055954
 ]

ASF GitHub Bot logged work on KNOX-3589:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Nov/26 15:57
            Start Date: 19/Nov/26 15:57
    Worklog Time Spent: 10m 
      Work Description: smolnar82 commented on code in PR #1528:
URL: https://github.com/apache/knox/pull/1528#discussion_r4631222778


##########
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:
   Possible NPE: flip the condition:
   ```
   attributes == null || attributeNameMapper.isEmpty()
   ```





Issue Time Tracking
-------------------

    Worklog Id:     (was: 1055954)
    Time Spent: 20m  (was: 10m)

> 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: 20m
>  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)

Reply via email to