[
https://issues.apache.org/jira/browse/KNOX-3589?focusedWorklogId=1055944&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1055944
]
ASF GitHub Bot logged work on KNOX-3589:
----------------------------------------
Author: ASF GitHub Bot
Created on: 19/Nov/26 15:35
Start Date: 19/Nov/26 15:35
Worklog Time Spent: 10m
Work Description: handavid opened a new pull request, #1528:
URL: https://github.com/apache/knox/pull/1528
[KNOX-3589](https://issues.apache.org/jira/browse/KNOX-3589) - Rename remote
LDAP attributes to proxy-facing names
## What changes were proposed in this pull request?
The LDAP proxy surfaces remote attributes under their own names. Add a
per-backend attributeMappings list of remoteName:proxyName pairs so a remote
attribute can be exposed under a different, standard name on the proxy entry
(e.g. Active Directory's whenChanged as the RFC-standard modifyTimestamp),
without the client needing to know an AD server is behind the proxy.
The rename is bidirectional and applied in all three places so the proxy
name works end to end:
- on returned entries, the remote attribute is copied into the proxy entry
under the proxy name and the remote name is dropped;
- in the client's requested-attribute list, the proxy name is forwarded to
the remote server as the remote name (the only name it knows);
- in search filters, a condition on the proxy name is rewritten to the
remote name before the search is sent.
Values are copied verbatim, so only syntax-compatible attributes should be
mapped (whenChanged and modifyTimestamp are both GeneralizedTime). The target
name must be resolvable in the schema; modifyTimestamp is a standard
operational attribute Knox already knows. Lookups are case-insensitive and
malformed pairs are skipped rather than failing the backend. Credential-bearing
attributes are still stripped before any rename, so a mapping cannot surface
secrets under a different name.
## How was this patch tested?
Added unit tests.
Ran manual tests against active directory by adding a mapping to the
gateway-site.xml
```
<property>
<name>gateway.ldap.interceptor.adexample.attributeMappings</name>
<value>whenChanged:modifyTimestamp</value>
</property>
```
then ran searches using `modifyTimestamp` and see that the search works to
narrow the result set and that `modifyTimestamp` is included in the returned
entries. Since `modifyTimestamp` is an operational attribute in the proxy
schema, it needs to be requested explicitly or throug `+` for all operational
attributes.
```
ldapsearch -v -x -H ldap://localhost:3890 -D
'uid=bind2,ou=people,dc=proxy,dc=com' -w bind-password -E pr=250/noprompt -b
'ou=people,DC=proxy,DC=com' -s sub
'(&(objectClass=inetOrgPerson)(modifyTimestamp>=20261115074418.0Z))' '*' '+'
...
# configurator1, people, proxy.com
dn: CN=configurator1,ou=people,dc=proxy,dc=com
sAMAccountName: configurator1
objectGUID:: 5o6gb6zrl0CzZhYUVaj8Pg==
name: configurator1
memberOf: CN=configurators,ou=groups,dc=proxy,dc=com
givenName: configurator1
modifyTimestamp: 20261118163452.0Z
userAccountControl: 66048
displayName: configurator1
cn: configurator1
objectclass: top
objectclass: organizationalPerson
objectclass: user
objectclass: inetOrgPerson
distinguishedName: CN=configurator1,ou=people,dc=proxy,dc=com
uid: configurator1
```
## Integration Tests
No integration test were added because the test server has the same schema
as the proxy server.
## UI changes
No UI changes
Issue Time Tracking
-------------------
Worklog Id: (was: 1055944)
Remaining Estimate: 0h
Time Spent: 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: 10m
> 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)