pub struct BasicAuthMiddleware { /* private fields */ }Expand description
Basic authentication middleware
Implementations§
Source§impl BasicAuth
impl BasicAuth
Sourcepub fn new(config: BasicAuthConfig) -> AuthResult<Self>
pub fn new(config: BasicAuthConfig) -> AuthResult<Self>
Create new BasicAuth instance
Sourcepub fn metrics(&self) -> &AuthMetrics
pub fn metrics(&self) -> &AuthMetrics
Get metrics reference
Sourcepub fn with_users(users: HashMap<String, String>) -> AuthResult<Self>
pub fn with_users(users: HashMap<String, String>) -> AuthResult<Self>
Create BasicAuth with static user list
Sourcepub fn with_user(username: String, password: String) -> AuthResult<Self>
pub fn with_user(username: String, password: String) -> AuthResult<Self>
Create BasicAuth with a single user
Trait Implementations§
Source§impl<S, Cfg> Middleware<S, Cfg> for BasicAuth
impl<S, Cfg> Middleware<S, Cfg> for BasicAuth
Source§type Service = BasicAuthMiddlewareService<S>
type Service = BasicAuthMiddlewareService<S>
The middleware
Service value created by this factorySource§fn create(&self, service: S, _cfg: Cfg) -> Self::Service
fn create(&self, service: S, _cfg: Cfg) -> Self::Service
Creates and returns a new middleware service.
Source§fn apply<Fac, Req>(
self,
factory: Fac,
) -> ServiceChainFactory<ApplyMiddleware<Self, Fac, Cfg>, Req, Cfg>where
Fac: ServiceFactory<Req, Cfg, Service = Svc>,
Cfg: Clone,
Self: Sized,
Self::Service: Service<Req>,
fn apply<Fac, Req>(
self,
factory: Fac,
) -> ServiceChainFactory<ApplyMiddleware<Self, Fac, Cfg>, Req, Cfg>where
Fac: ServiceFactory<Req, Cfg, Service = Svc>,
Cfg: Clone,
Self: Sized,
Self::Service: Service<Req>,
Creates a service factory that instantiates a service and applies
the current middleware to it. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for BasicAuth
impl !UnwindSafe for BasicAuth
impl Freeze for BasicAuth
impl Send for BasicAuth
impl Sync for BasicAuth
impl Unpin for BasicAuth
impl UnsafeUnpin for BasicAuth
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