pub struct AuthContext {
pub username: String,
pub remote_addr: SocketAddr,
pub session_id: SessionId,
pub attempt_count: u32,
}Expand description
Context provided to authentication handlers.
Contains information about the authentication attempt including the username, remote address, and session identifier.
Fields§
§username: StringThe username attempting authentication.
remote_addr: SocketAddrThe remote address of the client.
session_id: SessionIdThe session ID for this connection.
attempt_count: u32Number of authentication attempts so far.
Implementations§
Source§impl AuthContext
impl AuthContext
Sourcepub fn new(
username: impl Into<String>,
remote_addr: SocketAddr,
session_id: SessionId,
) -> Self
pub fn new( username: impl Into<String>, remote_addr: SocketAddr, session_id: SessionId, ) -> Self
Creates a new authentication context.
Sourcepub fn with_attempt(self, count: u32) -> Self
pub fn with_attempt(self, count: u32) -> Self
Creates a context with an incremented attempt count.
Sourcepub fn remote_addr(&self) -> SocketAddr
pub fn remote_addr(&self) -> SocketAddr
Returns the remote address.
Sourcepub fn session_id(&self) -> SessionId
pub fn session_id(&self) -> SessionId
Returns the session ID.
Sourcepub fn attempt_count(&self) -> u32
pub fn attempt_count(&self) -> u32
Returns the current attempt count.
Trait Implementations§
Source§impl Clone for AuthContext
impl Clone for AuthContext
Source§fn clone(&self) -> AuthContext
fn clone(&self) -> AuthContext
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 AuthContext
impl RefUnwindSafe for AuthContext
impl Send for AuthContext
impl Sync for AuthContext
impl Unpin for AuthContext
impl UnwindSafe for AuthContext
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