Skip to content

Add back-channel client credentials flow to AuthProxy - #52

Merged
einari merged 5 commits into
mainfrom
copilot/resolve-client-credentials-back-channel
Jul 9, 2026
Merged

Add back-channel client credentials flow to AuthProxy#52
einari merged 5 commits into
mainfrom
copilot/resolve-client-credentials-back-channel

Conversation

Copilot AI commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds service-owned client-credentials support to AuthProxy via a back-channel verification flow. AuthProxy can now mint scoped bearer tokens from /.cratis/token and validate them on subsequent proxied requests.

Release notes are generated from this description:

Added

Changed

Fixed

Removed

Security

Deprecated

Example

{
  "Cratis": {
    "AuthProxy": {
      "Services": {
        "portal": {
          "Backend": { "BaseUrl": "http://portal-api:8080/" },
          "ClientCredentials": {
            "RoutePrefix": "/api",
            "VerificationPath": "/.cratis/client-credentials/verify"
          }
        }
      }
    }
  }
}

Copilot AI linked an issue Jul 7, 2026 that may be closed by this pull request
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
Copilot finished work on behalf of einari July 7, 2026 13:09
Copilot AI requested a review from einari July 7, 2026 13:09
einari added 3 commits July 7, 2026 19:56
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 einari added the minor label Jul 9, 2026
@einari
einari marked this pull request as ready for review July 9, 2026 18:29
@einari
einari merged commit 8abb5d6 into main Jul 9, 2026
3 checks passed
@einari
einari deleted the copilot/resolve-client-credentials-back-channel branch July 9, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve client credentials - back channel

2 participants