Support private_key_jwt client authentication (RFC 7523)

For machine clients using client_credentials, Sphinx supports client_secret_basic and client_secret_post. We run a client service at many customer sites, and a shared secret there is a reusable password stored on a machine we don't control.

Could Sphinx support private_key_jwt client authentication (OpenID Connect Core, section 9, RFC 7523)?

What it would need

  • Registering a public key, or a JWKS URI, on a client app, alongside or instead of ClientSecrets.
  • Accepting client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer with a signed client_assertion at /oauth/token, and checking:
    • the signature against the client's registered key
    • iss and sub equal to the client id
    • aud equal to the token endpoint
    • exp, and jti not seen before
  • Advertising it in token_endpoint_auth_methods_supported.
  • Ideally, ES256 or EdDSA signing on the client side without shipping OpenSSL (see Enable TMS Crypto Pack as a signing method in Bcl).

Why

  • No reusable secret sits on the client machine. Only the server holds the public key.
  • Keys can be rotated per client by registering several public keys, the same way ClientSecrets accepts several secrets.

The constants for this are already in Sphinx.Consts.pas, but nothing uses them yet.

It makes sense and it's an interesting feature. It will be included in next release.