Struct distant_net::AuthServer
source · [−]pub struct AuthServer<ChallengeFn, VerifyFn, InfoFn, ErrorFn> where
ChallengeFn: Fn(Vec<AuthQuestion>, HashMap<String, String>) -> Vec<String> + Send + Sync,
VerifyFn: Fn(AuthVerifyKind, String) -> bool + Send + Sync,
InfoFn: Fn(String) + Send + Sync,
ErrorFn: Fn(AuthErrorKind, String) + Send + Sync, {
pub on_challenge: ChallengeFn,
pub on_verify: VerifyFn,
pub on_info: InfoFn,
pub on_error: ErrorFn,
}
Expand description
Server that handles authentication
Fields
on_challenge: ChallengeFn
on_verify: VerifyFn
on_info: InfoFn
on_error: ErrorFn
Trait Implementations
sourceimpl<ChallengeFn, VerifyFn, InfoFn, ErrorFn> Server for AuthServer<ChallengeFn, VerifyFn, InfoFn, ErrorFn> where
ChallengeFn: Fn(Vec<AuthQuestion>, HashMap<String, String>) -> Vec<String> + Send + Sync,
VerifyFn: Fn(AuthVerifyKind, String) -> bool + Send + Sync,
InfoFn: Fn(String) + Send + Sync,
ErrorFn: Fn(AuthErrorKind, String) + Send + Sync,
impl<ChallengeFn, VerifyFn, InfoFn, ErrorFn> Server for AuthServer<ChallengeFn, VerifyFn, InfoFn, ErrorFn> where
ChallengeFn: Fn(Vec<AuthQuestion>, HashMap<String, String>) -> Vec<String> + Send + Sync,
VerifyFn: Fn(AuthVerifyKind, String) -> bool + Send + Sync,
InfoFn: Fn(String) + Send + Sync,
ErrorFn: Fn(AuthErrorKind, String) + Send + Sync,
type LocalData = RwLock<Option<XChaCha20Poly1305Codec>>
type LocalData = RwLock<Option<XChaCha20Poly1305Codec>>
Type of data to store locally tied to the specific connection
sourcefn on_request<'life0, 'async_trait>(
&'life0 self,
ctx: ServerCtx<Self::Request, Self::Response, Self::LocalData>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn on_request<'life0, 'async_trait>(
&'life0 self,
ctx: ServerCtx<Self::Request, Self::Response, Self::LocalData>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Invoked upon receiving a request from a client. The server should process this
request, which can be found in ctx
, and send one or more replies in response. Read more
sourcefn config(&self) -> ServerConfig
fn config(&self) -> ServerConfig
Returns configuration tied to server instance
sourcefn on_accept<'life0, 'life1, 'async_trait>(
&'life0 self,
local_data: &'life1 mut Self::LocalData
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn on_accept<'life0, 'life1, 'async_trait>(
&'life0 self,
local_data: &'life1 mut Self::LocalData
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Invoked immediately on server start, being provided the raw listener to use (untyped transport), and returning the listener when ready to start (enabling servers that need to tweak a listener to do so) Invoked upon a new connection becoming established, which provides a mutable reference to the data created for the connection. This can be useful in performing some additional initialization on the data prior to it being used anywhere else. Read more
Auto Trait Implementations
impl<ChallengeFn, VerifyFn, InfoFn, ErrorFn> RefUnwindSafe for AuthServer<ChallengeFn, VerifyFn, InfoFn, ErrorFn> where
ChallengeFn: RefUnwindSafe,
ErrorFn: RefUnwindSafe,
InfoFn: RefUnwindSafe,
VerifyFn: RefUnwindSafe,
impl<ChallengeFn, VerifyFn, InfoFn, ErrorFn> Send for AuthServer<ChallengeFn, VerifyFn, InfoFn, ErrorFn>
impl<ChallengeFn, VerifyFn, InfoFn, ErrorFn> Sync for AuthServer<ChallengeFn, VerifyFn, InfoFn, ErrorFn>
impl<ChallengeFn, VerifyFn, InfoFn, ErrorFn> Unpin for AuthServer<ChallengeFn, VerifyFn, InfoFn, ErrorFn> where
ChallengeFn: Unpin,
ErrorFn: Unpin,
InfoFn: Unpin,
VerifyFn: Unpin,
impl<ChallengeFn, VerifyFn, InfoFn, ErrorFn> UnwindSafe for AuthServer<ChallengeFn, VerifyFn, InfoFn, ErrorFn> where
ChallengeFn: UnwindSafe,
ErrorFn: UnwindSafe,
InfoFn: UnwindSafe,
VerifyFn: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more