Trait AuthenticationService

Source
pub trait AuthenticationService<S: Subject>:
    Send
    + Sync
    + Sized
    + Clone
    + 'static
    + Send {
    // Required methods
    fn header_name(&self) -> &str;
    fn cookie_name(&self) -> &str;
    fn authenticate(
        &self,
        token: Option<&str>,
        cookie: Option<&str>,
    ) -> impl Future<Output = Result<S>> + Send;
}
Expand description

Authentication service

Required Methods§

Source

fn header_name(&self) -> &str

Header name containing the authentication header

Source

fn cookie_name(&self) -> &str

Cookie name containing the authentication cookie

Source

fn authenticate( &self, token: Option<&str>, cookie: Option<&str>, ) -> impl Future<Output = Result<S>> + Send

Validates if the given token or cookie is valid and returns the authenticated subject

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<S: Subject, T: AuthenticationService<S> + ?Sized> AuthenticationService<S> for Box<T>
where Box<T>: Send + Sync + Sized + Clone + 'static,

Source§

fn header_name(&self) -> &str

Source§

fn cookie_name(&self) -> &str

Source§

async fn authenticate( &self, token: Option<&str>, cookie: Option<&str>, ) -> Result<S>

Source§

impl<S: Subject, T: AuthenticationService<S> + ?Sized> AuthenticationService<S> for Arc<T>
where Arc<T>: Send + Sync + Sized + Clone + 'static,

Source§

fn header_name(&self) -> &str

Source§

fn cookie_name(&self) -> &str

Source§

async fn authenticate( &self, token: Option<&str>, cookie: Option<&str>, ) -> Result<S>

Implementors§