KNOX-3395: Add KNOXTOKEN issuance and JWTProvider federation integration tests#1325
KNOX-3395: Add KNOXTOKEN issuance and JWTProvider federation integration tests#1325Raghav-Mah3shwari wants to merge 1 commit into
Conversation
|
Hi @pzampino , @smolnar82, can i get a review on this? thanks |
Test Results45 tests 45 ✅ 6s ⏱️ Results for commit e228bf0. |
|
Nice addition, @Raghav-Mah3shwari, the end-to-end path here (mint a token in knoxldap → present it to the JWTProvider-federated knoxtoken topology → assert x-knox-actor-username) is the highest-value scenario and it's covered cleanly. The file follows the suite conventions (common_utils, unittest, HTTPBasicAuth) and the issuance + negative auth cases all look correct. A couple of things before merge: 1. Missing token lifecyle operation test cases These endpoints require server-managed token state, which neither
To exercise them you'd need, on the Without the whitelist, token renewal or revocation will return 403 (revoking your own token is the one exception). Cases I'd suggest for that round:
2. Two minor notes on the existing tests:
|
What changes were proposed in this pull request?
This PR adds a new Docker Compose integration test suite that covers the
knoxtokentopology (JWTProvider federation) and the KNOXTOKEN token-issuance service. Both are baked into the CI test image but were previously exercised by no integration test.New file:
.github/workflows/tests/test_knoxtoken_jwt.pyIt validates a real end-to-end token flow:
gateway/knoxldap/knoxtoken/api/v1/token) using Basic auth.gateway/knoxtoken/auth/api/v1/pre) and confirm the caller identity is asserted.Test cases:
test_token_endpoint_returns_jwt_and_metadata— token response containsaccess_token,token_type: Bearer,expires_in, and the token is a well-formed 3-segment JWT.test_token_requires_authentication— anonymous token request returns 401.test_jwt_grants_access_to_federated_topology— a valid JWT authenticates and yieldsx-knox-actor-username: guest.test_federated_topology_requires_token— a request with no token returns 401.test_federated_topology_rejects_invalid_token— a malformed bearer token returns 401.The suite reuses the existing
common_utilshelpers and follows the current test style. It does not overlap with existing tests: all other suites use Basic auth or preauth headers, and none issue a Knox token or authenticate via JWTProvider.No production code, topologies, or workflow behavior are changed.
How was this patch tested?
knoxtoken/api/v1/tokenand JSON keysaccess_token/token_type/expires_in(gateway-service-knoxtoken/.../TokenResource.java).auth/api/v1/pre(gateway-service-auth/.../PreAuthResource.java).knoxtoken.xmlusesJWTProviderwithRS256, matching the gateway's default token signing algorithm.pytestrun indocker-compose.yml(it is not in the single-EKU--ignorelist), so it executes as part of the existing Docker Compose test job.Integration Tests
This PR is itself an addition of integration tests under
.github/workflows/tests. No Java unit tests are added because the change only introduces black-box HTTP integration tests against the packaged gateway; the underlying KNOXTOKEN and JWTProvider components already have Java unit coverage in their respective modules.UI changes
N/A — no UI changes.