feat(gate): add OAuth2 Client Credentials auth for registration gate#924
Merged
feat(gate): add OAuth2 Client Credentials auth for registration gate#924
Conversation
…917) Add `oauth2_client_credentials` as a fourth auth type for the registration gate. The registry acquires a fresh access token via the OAuth2 Client Credentials flow (RFC 6749 Section 4.4) before each gate invocation. - Add `_acquire_oauth2_token()` async function for token acquisition - Convert `_build_auth_headers()` to async with new OAuth2 branch - Fail-closed: block registration immediately if token cannot be acquired - Add startup validation and test token acquisition in `verify_gate_connectivity()` - Propagate 4 new config parameters across all deployment surfaces (Docker, Terraform/ECS, Helm/EKS, System Config page) - Add 14 new unit tests covering all OAuth2 code paths - Update registration-webhooks.md with OAuth2 documentation Closes #917
Add the 4 registration webhook fields (URL, auth header, auth token, timeout) to the System Config page under a new "Registration Webhook (Notifications)" group. These settings were already in config.py but not visible in the UI.
…tion Add a detailed table describing the 4 new OAuth2 Client Credentials parameters (token URL, client ID, client secret, scope) with required flags, descriptions, and deployment surface availability.
Step-by-step guide covering Entra App Registration setup, registry configuration, verification, and notes on using other IdPs (Okta, Auth0, Keycloak, Cognito).
CodeQL flagged clear-text logging of client_id as a credential. Show only the first 8 characters to avoid the finding while still being useful for debugging.
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.
Summary
oauth2_client_credentialsas a fourth auth type for the Registration Gate, enabling enterprise environments where the gate endpoint is protected by an OAuth2 identity provider (Entra ID, Okta, Auth0, Keycloak, Cognito)New Configuration Parameters
REGISTRATION_GATE_OAUTH2_TOKEN_URLREGISTRATION_GATE_OAUTH2_CLIENT_IDREGISTRATION_GATE_OAUTH2_CLIENT_SECRETREGISTRATION_GATE_OAUTH2_SCOPEFiles Changed (19 files)
Core implementation:
registry/schemas/registration_gate_models.py- NewOAUTH2_CLIENT_CREDENTIALSenum valueregistry/core/config.py- 4 new settings fieldsregistry/services/registration_gate_service.py- Token acquisition, async auth headers, fail-closed logic, startup validationregistry/api/config_routes.py- System Config page: OAuth2 gate fields + new webhook notifications groupDeployment surfaces:
.env.example, 3xdocker-compose*.yml, 5xterraform/aws-ecs/*, 3xcharts/*Tests and docs:
tests/unit/services/test_registration_gate_service.py- 14 new testsdocs/registration-webhooks.md- OAuth2 Client Credentials documentationTest plan
Closes #917