Struct pam_client::conv_mock::Conversation[][src]

pub struct Conversation {
    pub username: String,
    pub password: String,
    pub log: Vec<LogEntry>,
}

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

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]

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]

impl ConversationHandler for Conversation[src]

impl Debug for Conversation[src]

impl Default for Conversation[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.