ionflux.org | Impressum

Ionflux::Tools::AuthFile Class Reference
[Authentication]

File based authentication. More...

#include <AuthFile.hpp>

Inheritance diagram for Ionflux::Tools::AuthFile:

Inheritance graph
[legend]
Collaboration diagram for Ionflux::Tools::AuthFile:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AuthFile ()
 Constructor.
 AuthFile (const std::string &initAuthFile)
 Constructor.
virtual ~AuthFile ()
 Destructor.
virtual void setAuthFile (const std::string &newAuthFile)
 Set authentication file.
virtual bool auth (const std::string &username, const std::string &password)
 Authenticate user.
virtual void getSecret (const std::string &username, std::string &secret)
 Get secret.
virtual ReportergetLog ()
 Get Console output/logging facility.
virtual void printDebugInfo ()
 Print debug information.

Static Public Attributes

static const TokenType TT_USER_PASS_SEP
 Token type: Username/password separator.

Protected Member Functions

void parse ()
 Parse authentication file.

Protected Attributes

Ionflux::Tools::Reporter log
 Console output/logging.
std::string authFile
 Authentication file name.
std::vector< AuthDataauthData
 Authentication data vector.

Detailed Description

File based authentication.

Reads authentication data from a file and validates user accounts against the data stored in the authentication file. Each line of the authentication file represents a valid username/password pair in the following format:

<username>:<password hash>

Where 'password hash' is the hex-encoded SHA-1 hash of the password.


Constructor & Destructor Documentation

Ionflux::Tools::AuthFile::AuthFile  ) 
 

Constructor.

Construct new AuthFile object.

Ionflux::Tools::AuthFile::AuthFile const std::string &  initAuthFile  ) 
 

Constructor.

Construct new AuthFile object.

Parameters:
initAuthFile Authentication file name.

Ionflux::Tools::AuthFile::~AuthFile  )  [virtual]
 

Destructor.

Destruct AuthFile object.


Member Function Documentation

bool Ionflux::Tools::AuthFile::auth const std::string &  username,
const std::string &  password
[virtual]
 

Authenticate user.

Authenticate a username/password pair.

Parameters:
username Username.
password Password.
Returns:
true if the username and password are valid, false otherwise.

Implements Ionflux::Tools::Auth.

Reporter & Ionflux::Tools::AuthFile::getLog  )  [virtual]
 

Get Console output/logging facility.

Returns:
The console output/logging facility used by this object.

Implements Ionflux::Tools::Auth.

void Ionflux::Tools::AuthFile::getSecret const std::string &  username,
std::string &  secret
[virtual]
 

Get secret.

Get the secret associated with a username. If the username is not valid, the secret will be set to an empty string.

Note: The returned secret is the SHA-1 hash of the user's password.

Parameters:
username Username.
secret Where to store the secret.

Implements Ionflux::Tools::Auth.

void Ionflux::Tools::AuthFile::parse  )  [protected]
 

Parse authentication file.

Extract authentication data records from authentication file.

void Ionflux::Tools::AuthFile::printDebugInfo  )  [virtual]
 

Print debug information.

void Ionflux::Tools::AuthFile::setAuthFile const std::string &  newAuthFile  )  [virtual]
 

Set authentication file.

Set the authentication file name.

Parameters:
newAuthFile Authentication file name.


Member Data Documentation

std::vector<AuthData> Ionflux::Tools::AuthFile::authData [protected]
 

Authentication data vector.

std::string Ionflux::Tools::AuthFile::authFile [protected]
 

Authentication file name.

Ionflux::Tools::Reporter Ionflux::Tools::AuthFile::log [protected]
 

Console output/logging.

const TokenType Ionflux::Tools::AuthFile::TT_USER_PASS_SEP [static]
 

Initial value:

 {
    TokenType::USERTYPE_ID + 1, ":", false, 1}
Token type: Username/password separator.


The documentation for this class was generated from the following files:
Generated on Tue Mar 14 21:07:21 2006 for Ionflux Tools Class Library (iftools) by  doxygen 1.4.6