[][src]Trait pam::Converse

pub trait Converse {
    fn prompt_echo(&mut self, msg: &CStr) -> Result<CString, ()>;
fn prompt_blind(&mut self, msg: &CStr) -> Result<CString, ()>;
fn info(&mut self, msg: &CStr);
fn error(&mut self, msg: &CStr);
fn username(&self) -> &str; }

A trait representing the PAM authentification conversation

PAM authentification is done as a conversation mechanism, in which PAM asks several questions and the client (your code) answers them. This trait is a representation of such a conversation, which one method for each message PAM can send you.

This is the trait to implement if you want to customize the conversation with PAM. If you just want a simple login/password authentication, you can use the PasswordConv implementation provided by this crate.

Required methods

fn prompt_echo(&mut self, msg: &CStr) -> Result<CString, ()>

PAM requests a value that should be echoed to the user as they type it

This would typically be the username. The exact question is provided as the msg argument if you wish to display it to your user.

fn prompt_blind(&mut self, msg: &CStr) -> Result<CString, ()>

PAM requests a value that should be typed blindly by the user

This would typically be the password. The exact question is provided as the msg argument if you wish to display it to your user.

fn info(&mut self, msg: &CStr)

This is an informational message from PAM

fn error(&mut self, msg: &CStr)

This is an error message from PAM

fn username(&self) -> &str

Get the username that is being authenticated

This method is not a PAM callback, but is rather used by the Authenticator to setup the environment when opening a session.

Loading content...

Implementors

impl Converse for PasswordConv[src]

Loading content...