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 -- 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]
