KNOX-3096 - Remote Authentication Provider for Levaraging other Knox Instances#994
Merged
lmccay merged 10 commits intoapache:masterfrom Feb 25, 2025
Merged
KNOX-3096 - Remote Authentication Provider for Levaraging other Knox Instances#994lmccay merged 10 commits intoapache:masterfrom
lmccay merged 10 commits intoapache:masterfrom
Conversation
Contributor
Author
|
I will follow up with another change to chain the correlation id's across the local and remote knox instances. I want to get this in and make progress on it first. |
moresandeep
reviewed
Feb 25, 2025
...der-security-authc-remote/src/main/java/org/apache/knox/gateway/filter/RemoteAuthFilter.java
Show resolved
Hide resolved
...der-security-authc-remote/src/main/java/org/apache/knox/gateway/filter/RemoteAuthFilter.java
Show resolved
Hide resolved
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.
There are various possibilities for leveraging the authentication capabilities across Knox instances. One compelling reason is for containerized Knox instances within k8s that would like to accept CLIENT_ID and CLIENT_SECRET or Passcode tokens but do not have a local database provisioned. These Knox instances can accept the tokens by delegating the authentication to a remote instance configured with the appropriate database or other details that may not be available to all other instances. It will need to cache authentication results for a short but meaningful enough time to reduce the chance of authentication storms against the remote server. At the same time, authentication can't outlive a change in the user's status any dangerous amount of time. Perhaps default to 5 mins.
It should allow for the configuration of all relevant possible items such as:
How was this patch tested?
Added new unit tests and ran all existing tests.
Manually tested by configuring the RemoteAuthProvider to make calls from one topology to another in the same instance.
Sample topology:
The param 'remote.auth.url' specifies the knox auth service that returns the preauth headers for successful authentication events.
The param 'remote.auth.include.headers' indicates that the Authorization header should be sent to the remote auth service for it to be able to get the credentials and validate them.
The 'remote.auth.expire.after' param indicates the number of mins to cache the authentication results for the given header value - typically the same as the header included for credential access. In this case, the authorization header.
The 'remote.auth.user.header' and 'remote.auth.group.header' indicates the header expected header names that remote auth service will populate upon successful authentication for both username and the group memberships.
Using curl to access this endpoint for acquiring an access token results in something like:
bash-3.2$ curl -iku guest:guest-password https://localhost:8444/gateway/tokengen/knoxtoken/api/v1/token
HTTP/1.1 200 OK
Date: Mon, 24 Feb 2025 06:15:47 GMT
Content-Type: application/json
Content-Length: 2175
{"access_token":"eyJqa3UiOiJodHRwczovL2xvY2FsaG9zdDo4NDQ0L2dhdGV3YXkvdG9rZW5nZW4va25veHRva2VuL2FwaS92MS9qd2tzLmpzb24iLCJraWQiOiJCR3JiSUQxa3RFRjMyV1N2N0Q3dGUxRGs2UTFFQUhEQ0RLMVJscUM5SVAwIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJndWVzdCIsI....wMzc3Nzc4LCJtYW5hZ2VkLnRva2VuIjoiZmFsc2UiLCJrbm94LmlkIjoiZmU2NTU3N2QtYzk2ZC00YmZmLWE5MjYtYjYwMjFkZDVhZWU3In0.OxqRrjryNXcaCzIqSCmH6hWpGxxZSH1GvJJ9e0zN3N41iMyDLB5LkUll6eLwDCRGrorI5HbtxKzhfQDPK3WVDXO2s78n4xrRWjuHFmu1dF8QrLHtdFQnX4bTGPrhXgtr309oiHSEzMza_Qw8V0L_7ybtwMvgXbKNQf1rGsCJ-y76le5SRIoFNDQeOJZPo9D153k-j6wC2vaOY8zaLh4qsDOh5IAuC9xujev0KFJNzVNwFN-vv2ClSQNxW4BoA0PuUBvPaGRxvG2ugV9s6ftqSC8wk-9VjKGAaSJ6cp2Ygsi_j4V_SAd6lSQINQUM6ZMfNLzJHkT-7yewC8pJK1q3vQ","token_id":"fe65577d-c96d-4bff-a926-b6021dd5aee7","managed":"false","endpoint_public_cert":"MIIDWT...YMBYwFAYDVR0RBA0wC4IJbG9jYWxob3N0MA0GCSqGSIb3DQEBBQUAA4IBAQCBTc5905y6HxrOtWBN44B1riZeFBNl+somt5blglzLRY8Oqj9L35/TPz6IeHsa+7uASOf2ELPgdJCnAX91O+mEtr9zxdri9qtBm8/FzoadUIFoyTkjrl6bxDd1qd48lsFAXUaZ1v6h669qB8atexb95QLXDc3LCC1FWTZssNVtbxOCZU6wMQBfiUinFwFPRVzQJg6lc/+iy+Kv0nr0b9M2RXZ3C+FukiyZXnV2ffEsvND9/2R0AnMTIQ9+brH8p73b39WA6mZNMzY2E6YiaFCEdXUc4lqJHw/eXCVdTc6W3Ex1oqtRS1e5/v5PCCD3GUupUNVBGb9mHBm6w0PweYCP","token_type":"Bearer","expires_in":1740377778029}
Please review Knox Contributing Process before opening a pull request.