reSIProcate/repro  9694
Public Types | Public Member Functions | Private Member Functions | Private Attributes
repro::UserStore Class Reference

#include <UserStore.hxx>

Collaboration diagram for repro::UserStore:
Collaboration graph
[legend]

List of all members.

Public Types

typedef resip::Data Key

Public Member Functions

 UserStore (AbstractDb &db)
virtual ~UserStore ()
AbstractDb::UserRecord getUserInfo (const Key &key) const
resip::Data getUserAuthInfo (const resip::Data &user, const resip::Data &realm) const
bool addUser (const resip::Data &user, const resip::Data &domain, const resip::Data &realm, const resip::Data &password, bool applyA1HashToPassword, const resip::Data &fullName, const resip::Data &emailAddress)
void eraseUser (const Key &key)
bool updateUser (const Key &originalKey, const resip::Data &user, const resip::Data &domain, const resip::Data &realm, const resip::Data &password, bool applyA1HashToPassword, const resip::Data &fullName, const resip::Data &emailAddress)
Key getFirstKey ()
Key getNextKey ()

Private Member Functions

Key buildKey (const resip::Data &user, const resip::Data &domain) const

Private Attributes

AbstractDbmDb

Detailed Description

Definition at line 20 of file UserStore.hxx.


Member Typedef Documentation

Definition at line 23 of file UserStore.hxx.


Constructor & Destructor Documentation

UserStore::UserStore ( AbstractDb db)

Definition at line 24 of file UserStore.cxx.

                                   :
   mDb(db)
{ 
}
UserStore::~UserStore ( ) [virtual]

Definition at line 29 of file UserStore.cxx.

{ 
}

Member Function Documentation

bool UserStore::addUser ( const resip::Data user,
const resip::Data domain,
const resip::Data realm,
const resip::Data password,
bool  applyA1HashToPassword,
const resip::Data fullName,
const resip::Data emailAddress 
)

Definition at line 51 of file UserStore.cxx.

{
   AbstractDb::UserRecord rec;
   rec.user = username;
   rec.domain = domain;
   rec.realm = realm;
   if(applyA1HashToPassword)
   {
      MD5Stream a1;
      a1 << username
         << Symbols::COLON
         << realm
         << Symbols::COLON
         << password;
      a1.flush();
      rec.passwordHash = a1.getHex();
   }
   else
   {
      rec.passwordHash = password;
   }
   rec.name = fullName;
   rec.email = emailAddress;
   rec.forwardAddress = Data::Empty;

   return mDb.addUser( buildKey(username,domain), rec);
}
UserStore::Key UserStore::buildKey ( const resip::Data user,
const resip::Data domain 
) const [private]

Definition at line 128 of file UserStore.cxx.

{
   Data ret = user + Data("@") + realm;
   return ret;
}
void UserStore::eraseUser ( const Key key)

Definition at line 87 of file UserStore.cxx.

{ 
   mDb.eraseUser( key );
}
UserStore::Key UserStore::getFirstKey ( )

Definition at line 114 of file UserStore.cxx.

{
   return mDb.firstUserKey();
}
UserStore::Key UserStore::getNextKey ( )

Definition at line 121 of file UserStore.cxx.

{
   return mDb.nextUserKey();
}
Data UserStore::getUserAuthInfo ( const resip::Data user,
const resip::Data realm 
) const

Definition at line 42 of file UserStore.cxx.

{
   Key key =  buildKey(user, realm);
   return mDb.getUserAuthInfo( key );
}
AbstractDb::UserRecord UserStore::getUserInfo ( const Key key) const

Definition at line 35 of file UserStore.cxx.

{
   return mDb.getUser(key);
}
bool UserStore::updateUser ( const Key originalKey,
const resip::Data user,
const resip::Data domain,
const resip::Data realm,
const resip::Data password,
bool  applyA1HashToPassword,
const resip::Data fullName,
const resip::Data emailAddress 
)

Definition at line 93 of file UserStore.cxx.

{
   Key newkey = buildKey(user, domain);
   
   bool ret = addUser(user, domain, realm, password, applyA1HashToPassword, fullName, emailAddress);
   if ( newkey != originalKey )
   {
      eraseUser(originalKey);
   }
   return ret;
}

Member Data Documentation

Definition at line 60 of file UserStore.hxx.


The documentation for this class was generated from the following files: