[
https://issues.apache.org/jira/browse/KNOX-3605?focusedWorklogId=1056353&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1056353
]
ASF GitHub Bot logged work on KNOX-3605:
----------------------------------------
Author: ASF GitHub Bot
Created on: 21/Nov/26 00:33
Start Date: 21/Nov/26 00:33
Worklog Time Spent: 10m
Work Description: handavid opened a new pull request, #1535:
URL: https://github.com/apache/knox/pull/1535
[KNOX-3605](https://issues.apache.org/jira/browse/KNOX-3605) - Skip role
lookup when memberOf not requested
## What changes were proposed in this pull request?
The LDAPRolesLookupInterceptor skips role lookup if the memberOf attribute
is not set as an returning attribute.
## How was this patch tested?
Added unit tests.
Manually tested by submitting search requests with and without the
`memberOf` attribute.
search for user without memberOf
```
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)(cn=sam))' cn
# sam, people, proxy.com
dn: CN=sam,ou=people,dc=proxy,dc=com
cn: sam
```
search for user with memberOf
```
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)(cn=sam))' cn
memberOf
# sam, people, proxy.com
dn: CN=sam,ou=people,dc=proxy,dc=com
cn: sam
memberOf: cn=datahub-2:env-admin,ou=groups,dc=proxy,dc=com
memberOf: cn=security:cluster-admin,ou=groups,dc=proxy,dc=com
memberOf: cn=dw-cluster-a:env-admin,ou=groups,dc=proxy,dc=com
memberOf: cn=security:awc-admin,ou=groups,dc=proxy,dc=com
memberOf: cn=env-staging:auditor,ou=groups,dc=proxy,dc=com
memberOf: cn=datahub-1:power-user,ou=groups,dc=proxy,dc=com
memberOf: cn=env-dev:env-admin,ou=groups,dc=proxy,dc=com
memberOf: cn=datahub-2:editor,ou=groups,dc=proxy,dc=com
```
## Integration Tests
Added integration test that searches against the ldap proxy with the roles
server configured. It searches for a user without specifying the `memberOf`
attribute and verifies that no `memberOf` attributes are returned.
## UI changes
No UI changes
Issue Time Tracking
-------------------
Worklog Id: (was: 1056353)
Remaining Estimate: 0h
Time Spent: 10m
> LDAPRolesLookupInterceptor adds memberOf when not requested
> -----------------------------------------------------------
>
> Key: KNOX-3605
> URL: https://issues.apache.org/jira/browse/KNOX-3605
> 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 LDAPRolesLookupInterceptor always adds the roles to the user and role
> entries in the memberOf attribute even if the memberOf attribute wasn't
> requested as a returning attribute.
> If not requested, we should skip the role lookup and entry modification.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)