[
https://issues.apache.org/jira/browse/KNOX-3570?focusedWorklogId=1054533&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1054533
]
ASF GitHub Bot logged work on KNOX-3570:
----------------------------------------
Author: ASF GitHub Bot
Created on: 13/Nov/26 10:09
Start Date: 13/Nov/26 10:09
Worklog Time Spent: 10m
Work Description: hanicz opened a new pull request, #1512:
URL: https://github.com/apache/knox/pull/1512
…ervice
[KNOX-3570](https://issues.apache.org/jira/browse/KNOX-3570) - Make the
roles lookup in the auth service optional per principal with a configurable
pattern
## What changes were proposed in this pull request?
When the identity assertion provider hasn't already done the roles lookup
(`ROLES_LOOKUP_EXECUTED` isn't set), `AbstractAuthResource.lookupRoles()` calls
`LDAPRolesLookupService` for every principal on every pre-auth/ext-authz check.
With the REST-backed `RestApiLdapRolesLookup`, every request makes an uncached
cross-cluster REST call, LDAP users included.
This adds a new service parameter, `preauth.roles.lookup.principal.pattern`:
- When it's set, the roles lookup runs only for principals that fully match
the regex. Use `|` for multiple alternatives, e.g.
`system:serviceaccount:.*|svc-.*`, the same way as
`group.lookup.skip.principal.pattern`.
- Principals that don't match skip the lookup and get their groups only.
- When it's not set or blank, every principal is looked up as before.
## How was this patch tested?
New unit tests in `PreAuthResourceTest` cover these cases:
- pattern not set
- blank pattern
- principal matches
- principal matches one alternative of a `|` pattern
- principal doesn't match
- principal only partially matches
Issue Time Tracking
-------------------
Worklog Id: (was: 1054533)
Remaining Estimate: 0h
Time Spent: 10m
> Make the roles lookup in the auth service optional per principal with a
> configurable pattern
> ---------------------------------------------------------------------------------------------
>
> Key: KNOX-3570
> URL: https://issues.apache.org/jira/browse/KNOX-3570
> Project: Apache Knox
> Issue Type: Improvement
> Components: Server
> Affects Versions: 3.1.0
> Reporter: Tamás Hanicz
> Assignee: Tamás Hanicz
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When the identity assertion provider hasn't already done the roles lookup
> (ROLES_LOOKUP_EXECUTED isn't set), AbstractAuthResource.lookupRoles() calls
> LDAPRolesLookupService for every principal on every pre-auth/ext-authz check.
> That's the case whenever the HadoopGroupProvider doesn't use Knox's
> in-process LDAP service. With the REST-backed RestApiLdapRolesLookup, every
> request makes an uncached cross-cluster REST call, LDAP users included.
> This adds a new service parameter, preauth.roles.lookup.principal.pattern.
> When it's set, the roles lookup runs only for principals that fully match the
> regex, for example system:serviceaccount:.*. Other principals skip the lookup
> and get their groups only. When it's not set, every principal is looked up as
> before.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)