Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

vos/metaobjects/misc/login.hh

Go to the documentation of this file.
00001 /* $Id: login.hh,v 1.9 2003/08/01 01:40:44 neil Exp $ */
00002 
00003 
00004 /* This file was generated by otd2cpp.pl, a script for VOS by Reed Hedges <reed@zerohour.net>.
00005 
00006    Search for TODO for stuff that needs editing. You will want to especially fill in constructors,
00007    destructors, message handlers, non-property subobjects...
00008 
00009    I can make no garuntee that this code will work, or even that it even is safe to run.
00010    Use it at your own risk.
00011 */
00012 
00013 /** @file login.hh Defines MetaObject class for Login type (revision 0).
00014 
00015 */
00016 
00017 #ifndef _LOGIN_HH_
00018 #define _LOGIN_HH_
00019 
00020 #if defined(_WIN32) && defined(_MSC_VER)
00021 # ifdef MISC_EXPORTS
00022 #  define MISC_API __declspec(dllexport)
00023 # else
00024 #  define MISC_API __declspec(dllimport)
00025 # endif
00026 #else
00027 # define MISC_API
00028 #endif
00029 
00030 #include <vos/corelibs/vos/vos.hh>
00031 #include <vos/metaobjects/property/property.hh>
00032 
00033 /** MetaObject implementing Login Object Type.
00034 
00035     An authentication point for challenge-response based identity
00036     verification. Identity is site-based, so granting authentication
00037     to any object on a site should authenticate the entire site.
00038     Successful completion of the protocol authenticates the user as
00039     having a legal username/password combination.
00040 
00041 */
00042 
00043 /** Local version of Login. */
00044 
00045 class MISC_API LocalLogin : public virtual MetaObject
00046 {
00047 public:
00048 
00049     /** Constructor */
00050     LocalLogin(MetaObject* superobject);
00051 
00052     /** Destructor */
00053     virtual ~LocalLogin();
00054 
00055     class BadUsernameError : public runtime_error {
00056     public:
00057         BadUsernameError(const string& s) : runtime_error(s) { };
00058     };
00059 
00060     virtual string getPassword(string username) = 0;
00061     virtual void notifyAuthenticated(const string& username, Site* site) = 0;
00062 
00063     virtual const string getType();
00064 
00065 protected:
00066 
00067     /** @name Message Handlers */
00068 //@{
00069 
00070     // TODO you might want to override some of these messages in LocalLogin and RemoteLogin.
00071 
00072     /** Handle message request-login (  Begin a login sequence.) */
00073     virtual void handleRequestLogin(Message* m);
00074 
00075     /** Handle message login-challenge-reply (  The user must append their password to the string supplied  with request-login-challenge, hash the result using MD5, and  transmit the hash.) */
00076     virtual void handleLoginChallengeReply(Message* m);
00077 
00078     //@}
00079 
00080     struct AuthState
00081     {
00082         string username;
00083         int timestamp;
00084         string nonce;
00085     };
00086     map<Site*, AuthState > nonceMap;
00087 };
00088 
00089 
00090 /** Remote version of Login. */
00091 
00092 class MISC_API RemoteLogin : public virtual MetaObject
00093 {
00094 public:
00095 
00096     /** Constructor */
00097     RemoteLogin(MetaObject* superobject);
00098 
00099     static void registerExtenders();
00100 
00101     /** Destructor */
00102     virtual ~RemoteLogin();
00103 
00104     /** Static generator, for factory. */
00105     static MetaObject* new_RemoteLogin(MetaObject* superobject, const string& type);
00106 
00107     /** @name Actuators.
00108         These are user-functions corresponding to messages. The remote actuators marshal arguments and send a message to the Local object. */
00109     //@{
00110 
00111     /** Send a request-login messsage to the local object. */
00112     virtual bool doRequestLogin(const string& username, const string& password);
00113 
00114     virtual const string getType();
00115 
00116 protected:
00117     /** @name Update Handlers. Handlers for remote update messages */
00118     //@{
00119 
00120     /** Handle a request-login-challenge messsage from the local object. */
00121     virtual void handleRequestLoginChallenge(Message* m);
00122 
00123     /** Handle a login-result messsage from the local object. */
00124     virtual void handleLoginResult(Message* m);
00125 
00126     //@}
00127 
00128     bool success;
00129     string password;
00130 };
00131 
00132 
00133 #endif // #ifdef _LOGIN_HH_
00134 

Generated on Tue Aug 12 03:55:44 2003 for Interreality Project - VOS by doxygen 1.3.2