pub struct DpopManager { /* private fields */ }Expand description
DPoP manager for handling proof-of-possession
Implementations§
Source§impl DpopManager
impl DpopManager
Sourcepub fn new(jwt_validator: SecureJwtValidator) -> Self
pub fn new(jwt_validator: SecureJwtValidator) -> Self
Create a new DPoP manager
Sourcepub async fn validate_dpop_proof(
&self,
dpop_proof: &str,
http_method: &str,
http_uri: &str,
access_token: Option<&str>,
expected_nonce: Option<&str>,
) -> Result<DpopValidationResult>
pub async fn validate_dpop_proof( &self, dpop_proof: &str, http_method: &str, http_uri: &str, access_token: Option<&str>, expected_nonce: Option<&str>, ) -> Result<DpopValidationResult>
Validate a DPoP proof JWT
Sourcepub async fn validate_dpop_proof_for_key(
&self,
dpop_proof: &str,
http_method: &str,
http_uri: &str,
access_token: Option<&str>,
expected_nonce: Option<&str>,
expected_jkt: Option<&str>,
) -> Result<DpopValidationResult>
pub async fn validate_dpop_proof_for_key( &self, dpop_proof: &str, http_method: &str, http_uri: &str, access_token: Option<&str>, expected_nonce: Option<&str>, expected_jkt: Option<&str>, ) -> Result<DpopValidationResult>
Like Self::validate_dpop_proof; when expected_jkt is given, the proof must also be
signed by the key with that thumbprint. That is checked before the proof’s jti is
recorded, so a proof from any other key leaves no record behind.
Sourcepub fn create_dpop_confirmation(
&self,
public_key_jwk: &Value,
) -> Result<DpopConfirmation>
pub fn create_dpop_confirmation( &self, public_key_jwk: &Value, ) -> Result<DpopConfirmation>
Create DPoP confirmation for access token
Sourcepub fn validate_dpop_bound_token(
&self,
token_confirmation: &DpopConfirmation,
dpop_proof_jwk: &Value,
) -> Result<bool>
pub fn validate_dpop_bound_token( &self, token_confirmation: &DpopConfirmation, dpop_proof_jwk: &Value, ) -> Result<bool>
Validate DPoP-bound access token
Sourcepub async fn validate_dpop_bound_jwt(
&self,
access_token: &str,
key: &DecodingKey,
audience: &str,
dpop_proof: &str,
http_method: &str,
http_uri: &str,
) -> Result<()>
pub async fn validate_dpop_bound_jwt( &self, access_token: &str, key: &DecodingKey, audience: &str, dpop_proof: &str, http_method: &str, http_uri: &str, ) -> Result<()>
Validate a DPoP-bound JWT access token and the proof presented with it.
The token is validated first, with key: signature, expiry and the other standard
claims, by the SecureJwtValidator this manager was built with. It must be an access
token (typ of access; a refresh token, or a token with no typ, is refused) issued for
audience, which is required: the validator checks an audience only when it is configured
with one. Only then is its cnf claim read, and the proof must be signed by the key with
the jkt it names, carry the token’s hash (ath), and match the request. The proof is
recorded last.
Sourcepub async fn validate_dpop_bound_access_token(
&self,
_access_token: &str,
_token_confirmation: &DpopConfirmation,
_dpop_proof: &str,
_http_method: &str,
_http_uri: &str,
) -> Result<bool>
👎Deprecated since 0.6.0-rc202: it could not establish that the access token is genuine; use validate_dpop_bound_jwt, or validate the token yourself and call validate_dpop_proof_for_key with its jkt
pub async fn validate_dpop_bound_access_token( &self, _access_token: &str, _token_confirmation: &DpopConfirmation, _dpop_proof: &str, _http_method: &str, _http_uri: &str, ) -> Result<bool>
it could not establish that the access token is genuine; use validate_dpop_bound_jwt, or validate the token yourself and call validate_dpop_proof_for_key with its jkt
Formerly “validated” a DPoP-bound access token. It never checked the token’s signature: it read the claims of a JWT as they stood, so a forged token naming the proof’s key was accepted, and it could not look at an opaque token at all. It now always refuses.
Sourcepub fn generate_nonce(&self) -> String
pub fn generate_nonce(&self) -> String
Generate a nonce for DPoP proof
Sourcepub async fn cleanup_expired_nonces(&self)
pub async fn cleanup_expired_nonces(&self)
Clean up expired nonces
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DpopManager
impl !RefUnwindSafe for DpopManager
impl !UnwindSafe for DpopManager
impl Send for DpopManager
impl Sync for DpopManager
impl Unpin for DpopManager
impl UnsafeUnpin for DpopManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more