KNOX-3337: Add optional LDAP role lookup support#1247
Open
smolnar82 wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
Cc. @handavid |
Test Results22 tests 22 ✅ 2s ⏱️ Results for commit 01a5749. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
KNOX-3337 - Introduce LDAP Role Lookup Service
What changes were proposed in this pull request?
This PR introduces a new LDAPRolesLookupService to Apache Knox, allowing for dynamic mapping of users and groups to specific roles during the authentication process. This is particularly useful for downstream services that require fine-grained role information (e.g.,
platform:admin,workspace:viewer) rather than just raw LDAP groups.Key changes include:
LDAPRolesLookupServicewith a pluggable strategy pattern.FileBasedLdapRolesLookup: Maps roles based on a local JSON configuration file.RestApiLdapRolesLookup: Queries an external REST API to retrieve role assignments.KnoxLDAPServiceIntegration: Updated the embedded LDAP service to optionally utilize the role lookup service, allowing it to return resolved roles in place of groups.Header Propagation: Updated AbstractAuthResource (used byPreAuthandExtAuthzresources) to populate a newX-Knox-Actor-RolesHTTP header when role lookups are successful.GatewayConfigproperties to configure the lookup strategy, file paths, and API endpoints.How was this patch tested?
The changes were verified through both existing and newly added unit tests:
FileBasedLdapRolesLookupTest: Verified JSON mapping logic for users and groups.RestApiLdapRolesLookupTest: Verified REST API integration using mocked HTTP clients.KnoxLDAPServiceTest: Updated to ensuregetUserGroupscorrectly integrates with the lookup service when enabled.PreAuthResourceTest: AddedtestPopulatingRolesHeaderto verifyX-Knox-Actor-Rolesis set correctly.ExtAuthzResourceTest: AddedtestPopulatingRolesHeaderto verify role propagation in external authorization flows.Integration Tests
No automated test added this time, but I configured Knox with MockServer as role lookup provider
and set the following configs in
gateway-reloadable.xml:Verified that the LDAP roles loookup service (as well as the Knox LDAP service) was reconfigured properly:
Then issued the following
curlcommands:Checked the logs:
I also ran the new KnoxCLI command:
UI changes
N/A