📄 waruserauth.h
字号:
/** This is the base-class for the 'glue' from the WarUserHandle to the actual implementation of the user database and authentication scheme (or the comm-link to a service that provice such). WarUserAuth derived classes can be chained, so that if one implementation fails to authenticate a user, the next one in the chain gets a try.*/#ifndef WAR_USER_AUTH_H#define WAR_USER_AUTH_H/* SYSTEM INCLUDES */#ifndef WAR_SET_INCLUDED# define WAR_SET_INCLUDED# include <set>#endif#ifndef WAR_LIST_INCLUDED# define WAR_LIST_INCLUDED# include <list>#endif/* PROJECT INCLUDES */#ifndef WAR_SMART_POINTER_H# include "WarSmartPointer.h"#endif#ifndef WAR_SVR_ENUMS_H# include "WarSvrEnums.h"#endif#ifndef WAR_USER_AUTH_DATA_H# include "WarUserAuthData.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */class WarSvrProtocol;#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarUserAuth : public WarSmartPointer, public WarSvrEnums{public: typedef std::set<war_authdata_ptr_t> user_set_t; // LIFECYCLE /** * Default constructor. */ WarUserAuth(void); /** * Destructor. */ ~WarUserAuth(void); // OPERATORS // OPERATIONS /** User login * * * @param virtualHost The virtual host given * the user is trying to use. This is * most used with the HTTP protocol. * The auth-handler can choose to ignore * this argument. * * @param userName The login-name provided by * the user. If this is NULL, an anonumous/guest * user is assumed. * * @param userPasswd. The password provided * by the user. If this is NULL, * the handler will return LF_NEED_PASSWORD * or LF_NEED_EMAIL_AS_PWD if a password * is requiered, or if anonymous logins are * alowed with the email address as password. * * @param isAuthorative Returns true if this * handler is authorative for the user, and * no more handlers should be queried. * * @param authDataPtr This argument is used to * store implementation dependent values * for the login. * * @return LF_OK is the user is logged in * LF_CALLER_NOT_AUTHENTICATED if the * handler don't recognize the user. * Else a WarLoginResultE value indicating the * why the login was denied. * * @exception WarException on error. A Failed login * is not an error. */ virtual WarLoginResultE Login( WarSvrProtocol& fromServer, war_ccsysstr_t virtualHost, war_ccsysstr_t userName, war_ccsysstr_t userPasswd, war_authdata_ptr_t& authDataPtr, bool &isAuthorative) throw(WarException) = 0; virtual void SetEnableAnon(const bool doEnable = true) throw(WarException) { WarThrow(WarError(WAR_ERR_FEATURE_NOT_SUPPORTED), NULL); } virtual void CreateUser(war_ccsysstr_t userName, war_ccsysstr_t userPasswd, const bool doEnable = false) throw(WarException) { WarThrow(WarError(WAR_ERR_FEATURE_NOT_SUPPORTED), NULL); } virtual void DeleteUser(war_ccsysstr_t userName) throw(WarException) { WarThrow(WarError(WAR_ERR_FEATURE_NOT_SUPPORTED), NULL); } virtual void CreateGroup(war_ccsysstr_t userName, war_ccsysstr_t userPasswd, const bool doEnable = false) throw(WarException) { WarThrow(WarError(WAR_ERR_FEATURE_NOT_SUPPORTED), NULL); } virtual void AddUserToGroup(war_ccsysstr_t userName, war_ccsysstr_t groupName) throw(WarException) { WarThrow(WarError(WAR_ERR_FEATURE_NOT_SUPPORTED), NULL); } virtual void RemoveUserFromGroup(war_ccsysstr_t userName, war_ccsysstr_t groupName) throw(WarException) { WarThrow(WarError(WAR_ERR_FEATURE_NOT_SUPPORTED), NULL); } static WarCollector<char> GeneratePasswd(unsigned pwdLength = 16); // ACCESS // INQUIRY /** Returns a list of all user-names known by * the module */ virtual void EnumerateUsers(user_set_t& outList) throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /** Is anonymous login supported by the module * If set, the SetEnableAnon() method is valid. */ virtual bool IsAnonSupported() const {return false;} /** Is anonymous login enabled */ virtual bool IsAnonAllowed() const {return false; } /** Can create a client user account */ virtual bool CanCreateUser() const {return false; } /** Can delete a client user account */ virtual bool CanDeleteUser() const {return false; } /** Can create a group */ virtual bool CanCreateGroup() const {return false; } /** Can delete a group */ virtual bool CanDeleteGroup() const {return false; } /** Can add a user to a group */ virtual bool CanAddUserToGroup() const {return false; } /** Can remove a user from a group */ virtual bool CanRemoveUserFromGroup() const {return false; } protected:private:};/* INLINE METHODS *//* EXTERNAL REFERENCES */typedef WarPtrWrapper<WarUserAuth> war_user_auth_ptr_t;typedef std::list<war_user_auth_ptr_t> war_user_auth_list_t;#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif /* WAR_USER_AUTH_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -