Skip to main content

Module client_auth

Module client_auth 

Source
Expand description

Confidential clients: private_key_jwt client authentication.

A confidential client names private_key_jwt as its token_endpoint_auth_method and publishes its public keys in its client metadata, as jwks or behind jwks_uri. Every request it makes to POST /oauth/par and POST /oauth/token carries a client_assertion: a JWT it signs with one of those keys (RFC 7523 §2.2). A public client (none) sends none, and a request from one that carries one is refused.

A confidential client’s login is bound to the key its assertion at PAR was signed with (ClientAuthKey), as the atproto profile’s “Confidential Client Authentication” requires. The code, and every refresh after it, is refused unless the request is signed with that same key, found in the key set the client publishes now; see crate::oauth::token.

An assertion is single-use. Its jti is held for as long as the assertion could still be accepted, in a window bounded the way the DPoP proof window is (crate::replay).

Structs§

AssertionClaims 🔒
The claims this module reads itself. jsonwebtoken checks iss, sub, aud, exp and nbf.
AuthenticatedClient
A confidential client that authenticated a request, and the key it signed with.
ClientAssertionVerifier
Checks client assertions, and holds the jti of each one it accepts until the assertion could no longer be accepted anyway.
ClientAuthentication
How a client authenticates: the client authentication half of its metadata document, flattened into ClientMetadataDocument.
ClientCredentials
The client authentication a request carries: RFC 7521 §4.2’s two parameters, as they arrived.
Jwks
A confidential client’s key set, as this server reads it: the keys it can check an assertion against.

Enums§

ClientAuthError
Why a client did not authenticate.

Constants§

ALGORITHM 🔒
SIGNING_ALG, as jsonwebtoken names it.
ASSERTION_CLOCK_SKEW
How far a client’s clock may sit from this server’s, either way, when an assertion’s iat, exp and nbf are read.
ASSERTION_MAX_AGE
How old an assertion may be, by its iat, before it has expired. ASSERTION_CLOCK_SKEW is allowed on top.
ASSERTION_TYPE
The client_assertion_type a confidential client sends (RFC 7523 §2.2).
NONE
The token_endpoint_auth_method of a public client.
PRIVATE_KEY_JWT
The token_endpoint_auth_method of a confidential client.
SIGNING_ALG
The algorithm a confidential client signs its assertions with. The atproto profile requires every client and server to support ES256, and this server verifies nothing else.

Functions§

invalid 🔒
An ClientAuthError::Invalid saying what.
refusal 🔒
What a failed signature or claim check says, in this server’s words.
replay_key 🔒
Where a spent jti is held: a digest of the client and the jti together, so two clients’ jtis never collide and a long client_id costs the window no more than a short one.
usable 🔒
published, if it is a key an assertion can be checked against.
window 🔒
The longest an assertion is accepted for after its iat, clock skew included, and so how long its jti is held.