Back to index

nordugrid-arc-nox  1.1.0~rc6
UsernameToken.h
Go to the documentation of this file.
00001 #ifndef __ARC_USERNAMETOKEN_H__
00002 #define __ARC_USERNAMETOKEN_H__
00003 
00004 #include <arc/XMLNode.h>
00005 #include <arc/message/SOAPEnvelope.h>
00006 
00007 // WS-Security Username Token Profile v1.1
00008 // wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
00009 
00010 namespace Arc {
00011 
00013 class UsernameToken {
00014 protected:
00015   XMLNode header_; 
00016 public:
00017   typedef enum {
00018     PasswordText,
00019     PasswordDigest
00020   } PasswordType;
00021 
00025   UsernameToken(SOAPEnvelope& soap);
00035   UsernameToken(SOAPEnvelope& soap, const std::string& username, const std::string& password,const std::string& uid, PasswordType pwdtype);
00036 
00045   UsernameToken(SOAPEnvelope& soap, const std::string& username, const std::string& id, bool mac, int iteration);
00046   
00048   operator bool(void);
00049 
00051   std::string Username(void);
00052 
00057   bool Authenticate(const std::string& password,std::string& derived_key);
00058 
00061   bool Authenticate(std::istream& password,std::string& derived_key);
00062 
00063 private:
00065   static bool Check(SOAPEnvelope& soap);
00066 private:
00067   std::string username_;
00068   std::string uid_;
00069   std::string password_;
00070   std::string passwdtype_;
00071   std::string nonce_;
00072   std::string created_;
00073   std::string salt_;
00074   int iteration_;
00075 };
00076 
00077 } // namespace Arc
00078 
00079 #endif /* __ARC_USERNAMETOKEN_H__ */
00080