#include <ArServerUserInfo.h>
For a description of the algorithm used to match passwords and keys and all look at the documentation for ArServerBase.
The file format for this class is set up to be easy to make a new version of and yet read all the old versions.
For all of the versions everything after ; or # is ignored. The version information is then the first line of non comments.
The first version is described as such: The version string is 'UserInfoVersion1
'. Then there are lines that follow for each user which are 'user
userName password groups'. The passwords are plain text in the file, though they aren't sent that way over the network (look at ArServerBase docs for details). To display the groups available use ArServerBase::logCommandGroups().
There is an example user info file in ArNetworking/examples/serverDemo.userInfo
Public Member Functions | |
ArServerUserInfo (const char *baseDirectory=NULL) | |
Constructor. | |
bool | doNotUse (void) const |
std::set< std::string, ArStrCaseCmpOp > | getUsersGroups (const char *user) const |
Gets the groups a user is in (returns empty set if no user). | |
void | logUsers (void) const |
Logs the users and groups. | |
bool | matchUserPassword (const char *user, unsigned char password[16], const char *passwordKey, const char *serverKey, bool logFailureVerbosely=false) const |
Matchs a user and password, false if user or password is wrong. | |
bool | readFile (const char *fileName) |
Loads the file, returns false if it wasn't there. | |
void | setBaseDirectory (const char *baseDirectory) |
Sets the base directory. | |
~ArServerUserInfo () | |
Destructor. | |
Protected Member Functions | |
void | logDigest (unsigned char digest[16]) const |
void | removeHandlers (void) |
bool | v1DoNotUseCallback (ArArgumentBuilder *arg) |
bool | v1HeaderCallback (ArArgumentBuilder *arg) |
bool | v1UserCallback (ArArgumentBuilder *arg) |
Protected Attributes | |
std::string | myBaseDirectory |
ArMutex | myDataMutex |
bool | myDoNotUse |
bool | myGotHeader |
std::map< std::string, std::set< std::string, ArStrCaseCmpOp > *, ArStrCaseCmpOp > | myGroups |
bool | myLogFailureVerbosely |
ArFileParser | myParser |
std::map< std::string, std::string, ArStrCaseCmpOp > | myPasswords |
ArRetFunctor1C< bool, ArServerUserInfo, ArArgumentBuilder * > | myV1DoNotUseCB |
ArRetFunctor1C< bool, ArServerUserInfo, ArArgumentBuilder * > | myV1HeaderCB |
ArRetFunctor1C< bool, ArServerUserInfo, ArArgumentBuilder * > | myV1UserCB |