Add back-channel client credentials flow to AuthProxy - #52
Merged
Conversation
Copilot
AI
changed the title
[WIP] Add support for client credentials flow in AuthProxy
Add back-channel client credentials flow to AuthProxy
Jul 7, 2026
Both the auth cookie and the new client-credentials bearer tokens are encrypted via ASP.NET Core Data Protection. Without an explicit key store, keys are per-instance and not guaranteed to survive a restart, so a token minted by one AuthProxy replica silently fails to validate on another and every restart invalidates all outstanding tokens and sessions. Add DataProtectionKeysPath so operators can point all replicas at a shared, persistent volume.
- Give the downstream verification HTTP client an explicit 10s timeout instead of the default ~100s, so a slow or hung verification endpoint can't tie up the anonymous /.cratis/token endpoint for that long. - Stash the token payload validated by the composite scheme selector in HttpContext.Items so ClientCredentialsBearerAuthenticationHandler doesn't unprotect the same bearer token a second time on every authenticated request. Falls back to validating directly when the handler is invoked without going through the composite scheme.
The anonymous /.cratis/token endpoint returned distinct OAuth error descriptions for "no services configured" vs "this named service isn't configured", letting an unauthenticated caller enumerate which services have client credentials configured by probing the 'service' form field. Both cases now return the same generic description, with the specific reason logged server-side instead.
einari
marked this pull request as ready for review
July 9, 2026 18:29
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
Adds service-owned client-credentials support to AuthProxy via a back-channel verification flow. AuthProxy can now mint scoped bearer tokens from
/.cratis/tokenand validate them on subsequent proxied requests.Release notes are generated from this description:
Added
POST /.cratis/tokento exchange verified client credentials for AuthProxy-issued bearer tokens (Resolve client credentials - back channel #51)ClientCredentialsconfiguration withRoutePrefixandVerificationPath(Resolve client credentials - back channel #51)Changed
Fixed
Removed
Security
Deprecated
Example
{ "Cratis": { "AuthProxy": { "Services": { "portal": { "Backend": { "BaseUrl": "http://portal-api:8080/" }, "ClientCredentials": { "RoutePrefix": "/api", "VerificationPath": "/.cratis/client-credentials/verify" } } } } } }