pub struct Conversation {
pub username: String,
pub password: String,
pub log: Vec<LogEntry>,
}
Expand description
Non-interactive implementation of ConversationHandler
When a PAM module asks for a non-secret string, username
will be returned and when a secret string is asked for,
password
will be returned.
All info and error messages will be recorded in log
.
§Limitations
This is enough to handle many authentication flows non-interactively, but
flows with two-factor-authentication and things like
chauthok()
will most definitely fail.
Please also note that UTF-8 encoding is assumed for both username and password, so this handler may fail to authenticate on legacy non-UTF-8 systems when one of the strings contains non-ASCII characters.
Fields§
§username: String
The username to use
password: String
The password to use
log: Vec<LogEntry>
All received info/error messages
Implementations§
Source§impl Conversation
impl Conversation
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new CLI conversation handler
If username
isn’t manually set to a non-empty
string, it will be automatically set to the Context
s default
username on context initialization.
Sourcepub fn with_credentials(
username: impl Into<String>,
password: impl Into<String>,
) -> Self
pub fn with_credentials( username: impl Into<String>, password: impl Into<String>, ) -> Self
Creatse a new CLI conversation handler with preset credentials
Sourcepub fn errors(&self) -> impl Iterator<Item = &CString> + FusedIterator
pub fn errors(&self) -> impl Iterator<Item = &CString> + FusedIterator
Lists only errors from the log
Sourcepub fn infos(&self) -> impl Iterator<Item = &CString> + FusedIterator
pub fn infos(&self) -> impl Iterator<Item = &CString> + FusedIterator
Lists only info messages from the log
Trait Implementations§
Source§impl Clone for Conversation
impl Clone for Conversation
Source§fn clone(&self) -> Conversation
fn clone(&self) -> Conversation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more