Struct AuthMiddleware
pub struct AuthMiddleware {
ldap_auth: Option<LdapManager>,
db: GCSharedConfigDatabase,
}Expand description
Authentication middleware This struct should holds all authentication methods.
Fields§
§ldap_auth: Option<LdapManager>§db: GCSharedConfigDatabaseImplementations§
§impl AuthMiddleware
impl AuthMiddleware
fn by_session(&self, req: &Request) -> Option<UserID>
fn by_api_key(&self, req: &Request) -> Option<UserID>
pub fn authenticated(&self, req: &Request) -> Option<UserID>
pub fn authenticated(&self, req: &Request) -> Option<UserID>
Check if the request is authenticated either by session cookie or API key
Check if the user is authorized to access the resource in the request
pub async fn authenticate(&self, req: Request) -> Response
pub async fn authenticate(&self, req: Request) -> Response
Authenticate the user If the user is successfully authenticated, a session cookie is set in the response and the user is redirected to the same place.
Trait Implementations§
§impl Clone for AuthMiddleware
impl Clone for AuthMiddleware
§fn clone(&self) -> AuthMiddleware
fn clone(&self) -> AuthMiddleware
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuthMiddleware
impl !RefUnwindSafe for AuthMiddleware
impl Send for AuthMiddleware
impl Sync for AuthMiddleware
impl Unpin for AuthMiddleware
impl !UnwindSafe for AuthMiddleware
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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