[
https://issues.apache.org/jira/browse/KNOX-3574?focusedWorklogId=1055552&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1055552
]
ASF GitHub Bot logged work on KNOX-3574:
----------------------------------------
Author: ASF GitHub Bot
Created on: 18/Nov/26 07:12
Start Date: 18/Nov/26 07:12
Worklog Time Spent: 10m
Work Description: 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
Issue Time Tracking
-------------------
Worklog Id: (was: 1055552)
Remaining Estimate: 0h
Time Spent: 10m
> LDAP proxy backend returns operational attributes
> -------------------------------------------------
>
> Key: KNOX-3574
> URL: https://issues.apache.org/jira/browse/KNOX-3574
> 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
>
> The returned attributes from the search should be passed directly to the
> backend so that operational attributes will be returned when specified.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)