Struct distant_net::common::authentication::AuthHandlerMap
source · pub struct AuthHandlerMap { /* private fields */ }Expand description
Implementation of AuthHandler that maintains a map of AuthMethodHandler implementations
for specific methods, invoking on_challenge, on_verification, on_info, and
on_error for a specific handler based on an associated id.
Implementations
sourceimpl AuthHandlerMap
impl AuthHandlerMap
sourcepub fn active_id(&self) -> &str
pub fn active_id(&self) -> &str
Returns the id of the active AuthMethodHandler.
sourcepub fn set_active_id(&mut self, id: impl Into<String>)
pub fn set_active_id(&mut self, id: impl Into<String>)
Sets the active AuthMethodHandler by its id.
sourcepub fn insert_method_handler<T: AuthMethodHandler + 'static>(
&mut self,
id: &'static str,
handler: T
) -> Option<Box<dyn AuthMethodHandler>>
pub fn insert_method_handler<T: AuthMethodHandler + 'static>(
&mut self,
id: &'static str,
handler: T
) -> Option<Box<dyn AuthMethodHandler>>
Inserts the specified handler into the map, associating it with id for determining the
method that would trigger this handler.
sourcepub fn remove_method_handler(
&mut self,
id: &'static str
) -> Option<Box<dyn AuthMethodHandler>>
pub fn remove_method_handler(
&mut self,
id: &'static str
) -> Option<Box<dyn AuthMethodHandler>>
Removes a handler with the associated id.
sourcepub fn get_mut_active_method_handler_or_error(
&mut self
) -> Result<&mut (dyn AuthMethodHandler + 'static)>
pub fn get_mut_active_method_handler_or_error(
&mut self
) -> Result<&mut (dyn AuthMethodHandler + 'static)>
Retrieves a mutable reference to the active AuthMethodHandler with the specified id,
returning an error if no handler for the active id is found.
sourcepub fn get_mut_active_method_handler(
&mut self
) -> Option<&mut (dyn AuthMethodHandler + 'static)>
pub fn get_mut_active_method_handler(
&mut self
) -> Option<&mut (dyn AuthMethodHandler + 'static)>
Retrieves a mutable reference to the active AuthMethodHandler with the specified id.
sourcepub fn get_mut_method_handler(
&mut self,
id: &str
) -> Option<&mut (dyn AuthMethodHandler + 'static)>
pub fn get_mut_method_handler(
&mut self,
id: &str
) -> Option<&mut (dyn AuthMethodHandler + 'static)>
Retrieves a mutable reference to the AuthMethodHandler with the specified id.
sourceimpl AuthHandlerMap
impl AuthHandlerMap
sourcepub fn with_static_key(self, key: impl Into<HeapSecretKey>) -> Self
pub fn with_static_key(self, key: impl Into<HeapSecretKey>) -> Self
Consumes the map, returning a new map that supports the static_key method.