AndroMeta  2.0.0
Public Member Functions
Meta::MAuth Class Reference

Secure network authentication. More...

#include <MAuth.h>

Inheritance diagram for Meta::MAuth:
Meta::MObject Meta::MProcessor Meta::MObjectBase

List of all members.

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 mvaruserData (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)

Detailed Description

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 & Destructor Documentation

Constructor.

Meta::MAuth::MAuth ( const mvar v,
RestoreOpt  opt 
)

Restore constructor.

Meta::MAuth::MAuth ( const MAuth auth)

Copy constructor.

Destructor.


Member Function Documentation

bool Meta::MAuth::addUser ( const mstr user,
const mstr password,
const mvar data = undef,
bool  temporary = false 
)

Add a user to the authentication system.

Parameters:
dataAdditional data to associate with a user which is not used directly in the authentication process.
temporaryIf a user is tempoary, the user persists only throughout the duration of this MAuth in memory, i.e: the user is not stored.
Returns:
true on success.
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.

Returns:
true if user exists, key is valid, and the user is allowed access to resource.

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.

Returns:
true on success.
bool Meta::MAuth::removeUser ( const mstr user)

Remove specified user and related data.

Returns:
true on succcess.
bool Meta::MAuth::revokeResource ( const mstr user,
const mstr resource 
)

Revoke a resource from the specified user.

Returns:
true on success.
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.

Returns:
true if successful
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.

Returns:
A vector of authenticated users maintained.

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