CPasswordCheck

Name

CPasswordCheck -- Authenticate against a stored password.

Synopsis


#include <PasswordCheck.h>
         
 class CPasswordCheck {

  CPasswordCheck(const std::string& password, const std::string prompt = std::string(""), Bool_t WithPrompt = kfFALSE);
  CPasswordCheck(const CPasswordCheck& rhs);

  ~CPasswordCheck();

  CPasswordCheck& operator=(const CPassswordCheck& rhs);
  const std::string getPassword();
  const std::string getPromptString();
  const Bool_t getWithPrompt();
  void setPassword(const std::string password);
  void setPromptString(const std::string prompt);
  virtual Bool_t Authenticate(CInteractor& interactor);
  void DisablePrompt();
  void EnablePrompt();
}

Description

Authenticators of type CPasswordCheck assume that the credential is a string that must exactly match some passphrase string. The passphrase can be dynamically modified if desired, according to the authentication policy of the application.

The passphase credential is gotten via an interactor. It is possible to control whether or not the credential is prompted for or not. If prompted, it is also possible to control the prompt string.

Public member functions

CPasswordCheck(const std::string& password, const std::string prompt = std::string(""), Bool_t WithPrompt = kfFALSE);

Constructor for the password checking authenticator. The password parameter provides the initial password which can be changed by later calling the setPassword member function. The prompt and WithPrompt parameters control prompting on the interactor. If WithPrompt is kfFALSE, no prompting will be done. If WithPrompt is kfTRUE, prompt will be used as the prompt string.

CPasswordCheck(const CPasswordCheck& rhs);

Does a copy construction of a CPasswordCheck object. This is a deep copy.

~CPasswordCheck();

Cleans up any storage or other resources allocated by the object.

CPasswordCheck& operator=(const CPassswordCheck& rhs);

Assignment operator. The rhs object is the source (right hand side) of the assignement operator. When complete, the object is an identical copy of the rhs.

const std::string getPassword();

Returns the current passphrase string.

const std::string getPromptString();

Returns the current prompt string.

const Bool_t getWithPrompt();

Returns kfTRUE if prompting for the passphrase is enabled. kfFALSE otherwise.

void setPassword(const std::string password);

Changes the passphrase. Future calls to Authenticate must obtain a credential string that matches the new passphrase password

void setPromptString(const std::string prompt);

Providses a new prompt string: prompt. This only matters if prompting is enabled.

virtual Bool_t Authenticate(CInteractor& interactor);

Authenticates, using interactor to obtain the candidate passphrase from the entity requesting service.

void DisablePrompt();

Disables passphrase prompting.

void EnablePrompt();

Enables passphrase prompting. The most recently set value of the prompt string will be used with the interactor to prompt for a password.

SEE ALSO

CAuthenticator(3daq), CInteractor(3daq)