handavid opened a new pull request, #1523:
URL: https://github.com/apache/knox/pull/1523

   [KNOX-3574](https://issues.apache.org/jira/browse/KNOX-3574) - A short 
description of the change
   
   ## What changes were proposed in this pull request?
   
   Rather than requesting '*', pass the requested attributes to the backend. 
This allows requesting operational attributes.
   
   The LDAP proxy only surfaces attributes the embedded schema knows, so remote 
attributes (e.g. operational ones) are dropped when a remote entry is converted 
to a proxy entry. Add a per-backend extraAttributes list that declares which 
remote attributes to import, instead of trusting the remote schema wholesale.
   
   At startup each backend reads the remote server's schema (quirks mode, so 
non-RFC-4512 schemas such as Active Directory's parse) and imports only the 
configured attributes, using the remote server's own definition. A configured 
attribute the remote server does not publish is logged as an error and skipped.
   
   Imported definitions are normalised so the strict bundled schema accepts 
them: a syntax the bundled schema lacks (e.g. the AD LargeInteger syntax 
1.2.840.113556.1.4.906) falls back to octet string, unresolvable matching rules 
are dropped, and a non-user-modifiable attribute is forced to operational usage 
(RFC 4512, ERR_13763). Attributes already registered by OID are left untouched.
   
   Also register whenChanged and objectGUID as built-in AD attribute types (on 
users and groups), and treat null/empty requested attributes as "*" in 
LdapProxyBackend.search() to avoid an NPE when forwarding a request with no 
attribute list.
   
   ## How was this patch tested?
   
   Added unit tests
   
   Manually tested against Active Directory to import attributes uSNCreated and 
uSNChanged.
   Example ldapsearch using newly built-in whenChanged attribute
   ```
   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)(whenChanged>=20261113133500.0Z))' '*' '+'
   ```
   with result also showing the uSNCreated and uSNChanged attributes 
   ```
   # user1, people, proxy.com
   dn: CN=user1,ou=people,dc=proxy,dc=com
   whenChanged: 20261113155507.0Z
   sAMAccountName: user1
   objectGUID:: 
MHgxOSAweEIxIDB4NTMgMHgxNyAweENGIDB4ODQgMHgyMCAweDQ3IDB4QUYgMHhFN
    yAweDQ0IDB4OTQgMHgzNSAweDE4IDB4NkEgMHg4MSA=
   name: user1
   givenName: user1
   userAccountControl: 66048
   displayName: user1
   cn: user1
   objectclass: top
   objectclass: organizationalPerson
   objectclass: user
   objectclass: inetOrgPerson
   uSNCreated: 737524
   uSNChanged: 2226842654
   distinguishedName: CN=user1,ou=people,dc=proxy,dc=com
   uid: user1
   ```
   Example ldapsearch using configured uSNCreated attribute has the same result
   ```
   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)(uSNCreated=737524))' '*' '+' 
   ```
   
   ## Integration Tests
   
   No integration tests added because the schema in the integration tests will 
already be the same as the schema in the LDAP Proxy. There are no remote 
attributes to import.
   
   ## 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]

Reply via email to