Skip to main content

DpopVerifier

Trait DpopVerifier 

Source
pub trait DpopVerifier: Send + Sync {
    // Required method
    fn verify(
        &self,
        proof: &str,
        http_method: &str,
        http_uri: &str,
        access_token: Option<&str>,
    ) -> Result<VerifiedProof, DpopError>;

    // Provided methods
    fn accept(&self, _proof: &VerifiedProof) -> Result<(), DpopError> { ... }
    fn nonce(&self) -> Option<String> { ... }
}
Expand description

What the OAuth routes and the resource routes need to bind a request to a client’s key.

http_method and http_uri are the request the proof was presented on — RFC 9449 binds a proof to the exact request it rides with. Nonces, replay detection and thumbprint computation are entirely crate::oauth::dpop’s concern; this trait only asks for the answer.

Required Methods§

Source

fn verify( &self, proof: &str, http_method: &str, http_uri: &str, access_token: Option<&str>, ) -> Result<VerifiedProof, DpopError>

Verifies proof (the DPoP request header) against the request it was presented on, returning the key it proves possession of.

access_token is the token this proof arrived alongside, when there is one: RFC 9449 §7.1 requires the proof’s ath claim to hash it, so that a proof minted for one token cannot be presented with another. None at /oauth/token, where no access token exists yet.

Provided Methods§

Source

fn accept(&self, _proof: &VerifiedProof) -> Result<(), DpopError>

Records a verified proof so that the same proof presented again is refused.

Called once the credential the proof arrived with has checked out, and not before: every route that takes a proof can be reached with a freshly generated key and no credential, so a caller that recorded at DpopVerifier::verify would be spending its replay window on strangers. Default: nothing to record.

Source

fn nonce(&self) -> Option<String>

The nonce a response to a DPoP request hands the client in DPoP-Nonce, or None for a verifier that checks none. Default: none.

Implementors§