Trait mas_axum_utils::csrf::CsrfExt

source ·
pub trait CsrfExt {
    // Required methods
    fn csrf_token<C, R>(self, clock: &C, rng: R) -> (CsrfToken, Self)
       where R: RngCore,
             C: Clock;
    fn verify_form<C, T>(
        &self,
        clock: &C,
        form: ProtectedForm<T>,
    ) -> Result<T, CsrfError>
       where C: Clock;
}

Required Methods§

source

fn csrf_token<C, R>(self, clock: &C, rng: R) -> (CsrfToken, Self)
where R: RngCore, C: Clock,

Get the current CSRF token out of the cookie jar, generating a new one if necessary

source

fn verify_form<C, T>( &self, clock: &C, form: ProtectedForm<T>, ) -> Result<T, CsrfError>
where C: Clock,

Verify that the given CSRF-protected form is valid, returning the inner value

§Errors

Returns an error if the CSRF cookie is missing or if the value in the form is invalid

Object Safety§

This trait is not object safe.

Implementors§