Skip to content

feat: add Private Key JWT (private_key_jwt) client authentication - #154

Draft
kishore7snehil wants to merge 1 commit into
mainfrom
feat/private-key-jwt-client-assertion
Draft

feat: add Private Key JWT (private_key_jwt) client authentication#154
kishore7snehil wants to merge 1 commit into
mainfrom
feat/private-key-jwt-client-assertion

Conversation

@kishore7snehil

Copy link
Copy Markdown
Contributor

📋 Changes

This PR adds Private Key JWT (private_key_jwt) client authentication to auth0-server-python, alongside the existing client secret. When a signing key is configured, the SDK authenticates to the token endpoint by signing a short-lived client assertion (RFC 7523) instead of sending a client secret. Client authentication is resolved in one place and applied uniformly across every token-endpoint call site.

✨ Features

  • New client_assertion_signing_key and client_assertion_signing_alg options on ServerClient select private_key_jwt; when neither a signing key nor a client secret is configured, token requests raise ConfigurationError before any network call
  • private_key_jwt is applied uniformly across all client-authenticated token requests: authorization code exchange, refresh token, Custom Token Exchange, connection access token (Token Vault), backchannel (CIBA) initiate and grant, PAR, and passkey signin
  • Caller-supplied client_assertion and client_assertion_type are rejected from token-exchange authorization_params, so the SDK-controlled client assertion cannot be overridden

🔧 API Changes

  • New ServerClient option client_assertion_signing_key: Optional[str] - a PKCS8 PEM private key that enables private_key_jwt
  • New ServerClient option client_assertion_signing_alg: Optional[str] - the assertion signing algorithm, defaulting to RS256
  • New build_client_assertion(private_key, client_id, issuer, alg) helper and CLIENT_ASSERTION_TYPE constant in auth0_server_python.auth_schemes.client_assertion
  • Pushed Authorization Requests now include the required response_type, which was previously missing and caused the request to be rejected

📖 Documentation

  • Added an "Authenticating with Private Key JWT" section to the client setup in README.md, showing the signing-key configuration and noting that private keys must not be committed to source control

🧪 Testing

  • This change adds test coverage
  • This change has been tested on the latest version of the platform/language

Contributor Checklist

Add private_key_jwt client authentication alongside the existing client
secret. When a signing key is configured, the SDK signs a short-lived
client assertion (RFC 7523) instead of sending a client secret. Client
authentication is resolved in one place and applied uniformly across
every token-endpoint call site.

Also include the required response_type on Pushed Authorization Requests,
which was previously missing and caused the request to be rejected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant