67 bool out_defined {
false} ;
72 Error(
const std::string & op ,
int pam_error ) ;
73 Error(
const std::string & op ,
int pam_error ,
const char * ) ;
75 using ItemArray = std::vector<Item> ;
77 Pam(
const std::string & app ,
const std::string & user ,
bool silent ) ;
91 std::string
name()
const ;
137 virtual void delay(
unsigned int usec ) = 0 ;
154 Pam(
const Pam & ) = delete ;
156 Pam & operator=(
const Pam & ) = delete ;
157 Pam & operator=(
Pam && ) = delete ;
160 std::unique_ptr<PamImp> m_imp ;
164G::Pam::Error::Error(
const std::string & op ,
int rc ) :
170G::Pam::Error::Error(
const std::string & op ,
int rc ,
const char * more ) :
171 G::Exception(
"pam error",op,Str::fromInt(rc),more)
A general-purpose exception class derived from std::exception and containing an error message.
An exception class for G::Pam.
A thin interface to the system PAM library, with two pure virtual methods that derived classes should...
void deleteCredentials()
Deletes credentials.
void checkAccount(bool require_token)
Does "account management", checking that the authenticated user is currently allowed to use the syste...
bool authenticate(bool require_token)
Authenticates the user.
virtual void delay(unsigned int usec)=0
Called when the pam library wants the application to introduce a delay to prevent brute-force attacks...
Pam(const std::string &app, const std::string &user, bool silent)
Constructor.
void refreshCredentials()
Refreshes credentials.
void openSession()
Starts a session.
void reinitialiseCredentials()
Reinitialises credentials.
virtual ~Pam()
Destructor.
std::string name() const
Returns the authenticated user name.
void closeSession()
Closes a session.
virtual void converse(ItemArray &)=0
Called to pass a message to the user, or request a password etc.
void establishCredentials()
Embues the authenticated user with their credentials, such as "tickets" in the form of environment va...
A static class which provides string helper functions.
A structure used by G::Pam to hold conversation items.