interreality.org [VOS]
[Home] [About]
[Screenshots]
[Download]
[News]
[Community]
[Documentation] [Manual]
[Bugs & Requests] [Wiki]

/home/tetron/hack/vos/libs/vos/vos/passwordauth.hh

Go to the documentation of this file.
00001 #ifndef _PASSWORDAUTH_HH_
00002 #define _PASSWORDAUTH_HH_
00003 
00004 #include <vos/vos/metaobject.hh>
00005 
00006 #ifndef VOS_EXPORTS
00007 IMPORT_METAOBJECT_FACTORIES(PasswordAuth)
00008 #endif
00009 
00010 namespace VOS {
00011 
00012 /** @class LocalPasswordAuth passwordauth.hh vos/vos/passwordauth.hh
00013     @ingroup libvos
00014 
00015     This class should be a cotype with an Identity Vobject.  It
00016     implements a secure hash-based challenge-response password
00017     validation protocol, and upon successfully completing the
00018     authentication, the remote site takes on this Identity.  The
00019     cleartext password is never sent during the validation protocol.
00020  */
00021 class VOS_API LocalPasswordAuth : public MetaObject
00022 {
00023 private:
00024     std::string password;
00025 
00026     LocalPasswordAuth(VobjectBase* superobject);
00027 public:
00028     /** destructor */
00029     virtual ~LocalPasswordAuth();
00030 
00031     /** Used by metaobject factory, never call directly */
00032     static MetaObject* new_LocalPasswordAuth(VobjectBase* superobject,
00033                                              const std::string& type);
00034 
00035     /** @return VOS type "core:passwordauth" */
00036     virtual const std::string getVOSType();
00037 
00038     /** Set the password (cleartext)
00039         @param password
00040     */
00041     void setPassword(const std::string& password);
00042 
00043     /** @return the password (cleartext) */
00044     std::string getPassword();
00045 
00046     /** Handles the challenge-reply protocol to authenticate
00047         a remote site to take on this identity.
00048     */
00049     void handleAuthRequest(Message* m);
00050     void handleSetPassword(Message* m);
00051 };
00052 
00053 /** @class RemotePasswordAuth passwordauth.hh vos/vos/passwordauth.hh
00054     @ingroup libvos
00055  */
00056 class VOS_API RemotePasswordAuth : public MetaObject
00057 {
00058     RemotePasswordAuth(VobjectBase* superobject);
00059 public:
00060     /** destructor */
00061     virtual ~RemotePasswordAuth();
00062 
00063     /** used by metaobject factory, never call directly */
00064     static MetaObject* new_RemotePasswordAuth(VobjectBase* superobject,
00065                                               const std::string& type);
00066 
00067     /** @return VOS type "core:passwordauth" */
00068     virtual const std::string getVOSType();
00069 
00070     /** Using the supplied password, will attempt an authentication
00071         protocol with the server in order to take on this Identity.
00072         The cleartext password is never sent during the validation
00073         protocol.
00074         @param password the password (cleartext)
00075         @throw AccessControlError if the authentication fails
00076     */
00077     void authenticate(const std::string& password);
00078 
00079     /** Request that the password be changed to the supplied password.
00080         You must have already taken on this this Identity using
00081         authenticate().  Note that this will send a CLEARTEXT
00082         password, that is, someone can sniff the password-set message
00083         to learn the password (unlike the authentication protocol
00084         which never sends the password) so use with care.
00085 
00086         @param password the password (cleartext)
00087         @throw AccessControlError if setting the password was not
00088         allowed
00089      */
00090     void setPassword(const std::string& password);
00091 };
00092 
00093 }
00094 
00095 #endif