Struct pam_client::conv_mock::Conversation [−][src]
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
impl Conversation[src]
#[must_use]pub const fn new() -> Self[src]
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.
#[must_use]pub fn with_credentials(
username: impl Into<String>,
password: impl Into<String>
) -> Self[src]
username: impl Into<String>,
password: impl Into<String>
) -> Self
Creatse a new CLI conversation handler with preset credentials
pub fn clear_log(&mut self)[src]
Clears the error/info log
pub fn errors(&self) -> impl Iterator<Item = &CString> + FusedIterator[src]
Lists only errors from the log
pub fn infos(&self) -> impl Iterator<Item = &CString> + FusedIterator[src]
Lists only info messages from the log
Trait Implementations
impl Clone for Conversation[src]
fn clone(&self) -> Conversation[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl ConversationHandler for Conversation[src]
fn init(&mut self, default_user: Option<impl AsRef<str>>)[src]
fn prompt_echo_on(&mut self, _msg: &CStr) -> Result<CString, ReturnCode>[src]
fn prompt_echo_off(&mut self, _msg: &CStr) -> Result<CString, ReturnCode>[src]
fn text_info(&mut self, msg: &CStr)[src]
fn error_msg(&mut self, msg: &CStr)[src]
impl Debug for Conversation[src]
impl Default for Conversation[src]
Auto Trait Implementations
impl RefUnwindSafe for Conversation[src]
impl Send for Conversation[src]
impl Sync for Conversation[src]
impl Unpin for Conversation[src]
impl UnwindSafe for Conversation[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,