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: StringThe username to use
password: StringThe 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 Contexts 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 moresource§impl ConversationHandler for Conversation
impl ConversationHandler for Conversation
source§fn prompt_echo_on(&mut self, _msg: &CStr) -> Result<CString, ErrorCode>
fn prompt_echo_on(&mut self, _msg: &CStr) -> Result<CString, ErrorCode>
source§fn prompt_echo_off(&mut self, _msg: &CStr) -> Result<CString, ErrorCode>
fn prompt_echo_off(&mut self, _msg: &CStr) -> Result<CString, ErrorCode>
source§impl Debug for Conversation
impl Debug for Conversation
Auto Trait Implementations§
impl Freeze for Conversation
impl RefUnwindSafe for Conversation
impl Send for Conversation
impl Sync for Conversation
impl Unpin for Conversation
impl UnwindSafe for Conversation
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)