|
AndroMeta
2.0.0
|
Secure network authentication. More...
#include <MAuth.h>
Public Member Functions | |
| MAuth () | |
| MAuth (const mvar &v, RestoreOpt opt) | |
| MAuth (const MAuth &auth) | |
| ~MAuth () | |
| void | store (mvar &v) const |
| bool | addUser (const mstr &user, const mstr &password, const mvar &data=undef, bool temporary=false) |
| mvec | users () const |
| bool | grantResource (const mstr &user, const mstr &resource) |
| bool | revokeResource (const mstr &user, const mstr &resource) |
| bool | removeUser (const mstr &user) |
| bool | authenticate (const mstr &user, const mstr &key, const mstr &resource="") |
| const mvar & | userData (const mstr &user) const |
| bool | setUserData (const mstr &user, const mvar &data) |
| void | setAllowAll (bool flag) |
| bool | allowAll () const |
| void | setCreateOnUnknown (bool flag) |
| bool | createOnUnknown () const |
| void | setMaxUserLength (size_t chars) |
Secure network authentication.
MAuth provides a secure and thread-safe authentication system used by the networking classes throughout the framework. Users are authenticated by username and key and have associated resource privileges. Application-specific data may also be associated with a user. MAuth is fully storeable and restoreable. See MEncoder for generating keys.
Constructor.
| Meta::MAuth::MAuth | ( | const mvar & | v, |
| RestoreOpt | opt | ||
| ) |
Restore constructor.
| Meta::MAuth::MAuth | ( | const MAuth & | auth | ) |
Copy constructor.
Destructor.
| bool Meta::MAuth::addUser | ( | const mstr & | user, |
| const mstr & | password, | ||
| const mvar & | data = undef, |
||
| bool | temporary = false |
||
| ) |
Add a user to the authentication system.
| data | Additional data to associate with a user which is not used directly in the authentication process. |
| temporary | If a user is tempoary, the user persists only throughout the duration of this MAuth in memory, i.e: the user is not stored. |
| bool Meta::MAuth::allowAll | ( | ) | const |
Get whether to bypass the authentication system, allowing all users permission to all resources.
| bool Meta::MAuth::authenticate | ( | const mstr & | user, |
| const mstr & | key, | ||
| const mstr & | resource = "" |
||
| ) |
Authenticate a user to grant access to a given resource.
| bool Meta::MAuth::createOnUnknown | ( | ) | const |
Get whether the create on unknown flag is set.
| bool Meta::MAuth::grantResource | ( | const mstr & | user, |
| const mstr & | resource | ||
| ) |
Grant a resource to the specified user.
| bool Meta::MAuth::removeUser | ( | const mstr & | user | ) |
Remove specified user and related data.
| bool Meta::MAuth::revokeResource | ( | const mstr & | user, |
| const mstr & | resource | ||
| ) |
Revoke a resource from the specified user.
| void Meta::MAuth::setAllowAll | ( | bool | flag | ) |
Set whether to bypass the authentication system, allowing all users permission to all resources.
| void Meta::MAuth::setCreateOnUnknown | ( | bool | flag | ) |
Set whether to allow a user to be created with the attempted password when an unknown user attempts to log in. Note like setAllowAll(true) this bypasses the authentication system. Default is off.
| void Meta::MAuth::setMaxUserLength | ( | size_t | chars | ) |
Set the maximum length of username. Default is 20.
| bool Meta::MAuth::setUserData | ( | const mstr & | user, |
| const mvar & | data | ||
| ) |
Set data associated with user.
| void Meta::MAuth::store | ( | mvar & | v | ) | const [virtual] |
Store the authenticator to v.
Reimplemented from Meta::MObject.
| const mvar& Meta::MAuth::userData | ( | const mstr & | user | ) | const |
Retrieve data associated with user.
| mvec Meta::MAuth::users | ( | ) | const |
1.7.6.1