(file) Return to ClientAuthenticator.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Client

  1 karl  1.7 //%2003////////////////////////////////////////////////////////////////////////
  2 mike  1.2 //
  3 karl  1.7 // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development
  4           // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
  5           // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
  6           // IBM Corp.; EMC Corporation, The Open Group.
  7 mike  1.2 //
  8           // Permission is hereby granted, free of charge, to any person obtaining a copy
  9           // of this software and associated documentation files (the "Software"), to
 10           // deal in the Software without restriction, including without limitation the
 11           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 12           // sell copies of the Software, and to permit persons to whom the Software is
 13           // furnished to do so, subject to the following conditions:
 14 kumpf 1.6 // 
 15 mike  1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 16           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 17           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 18           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 19           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 20           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 21           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 22           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 23           //
 24           //==============================================================================
 25           //
 26           // Author: Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
 27           //
 28           // Modified By: 
 29           //
 30           //%/////////////////////////////////////////////////////////////////////////////
 31           
 32           #ifndef Pegasus_ClientAuthenticator_h
 33           #define Pegasus_ClientAuthenticator_h
 34           
 35           #include <Pegasus/Common/Config.h>
 36 mike  1.2 #include <Pegasus/Common/Message.h>
 37           #include <Pegasus/Common/HTTPMessage.h>
 38           #include <Pegasus/Client/Linkage.h>
 39           
 40 kumpf 1.3 
 41 mike  1.2 PEGASUS_NAMESPACE_BEGIN
 42           
 43           
 44           /** This class owns client authentication 
 45           */
 46           class PEGASUS_CLIENT_LINKAGE ClientAuthenticator
 47           {
 48           public:
 49           
 50 kumpf 1.5     enum AuthType { NONE, BASIC, DIGEST, LOCAL, LOCALPRIVILEGED };
 51 mike  1.2 
 52               /** Constuctor. */
 53               ClientAuthenticator();
 54           
 55               /** Destructor. */
 56               ~ClientAuthenticator();
 57           
 58               /** Build the request authentication header.
 59               */
 60               String buildRequestAuthHeader();
 61           
 62               /** Check whether the response header has authentication challenge 
 63                   (i.e, WWW-Authenticate header).
 64               */
 65               Boolean checkResponseHeaderForChallenge(Array<HTTPHeader> headers);
 66           
 67               /** Save the request message for resending on a challenge.
 68               */
 69               void setRequestMessage(Message* message);
 70           
 71               /** Get the request message saved for resending on a challenge.
 72 mike  1.2     */
 73               Message* getRequestMessage();
 74           
 75               /** Clear the request buffer and other authentication informations
 76                   from the earlier request.
 77               */
 78 kumpf 1.8     void clear();
 79 mike  1.2 
 80               /** Set the user name
 81               */
 82               void setUserName(const String& userName);
 83           
 84               /** Get the user name
 85               */
 86               String getUserName();
 87           
 88               /** Set the upasswor
 89               */
 90               void setPassword(const String& password);
 91           
 92               /** Set the authentication type
 93               */
 94               void setAuthType(AuthType type);
 95           
 96               /** Get the authentication type
 97               */
 98               AuthType getAuthType();
 99           
100 mike  1.2 private:
101           
102 kumpf 1.4     String _buildLocalAuthResponse();
103           
104 mike  1.2     String _getFileContent(String filePath);
105           
106 kumpf 1.4     Boolean _parseAuthHeader(
107                   const String authHeader,
108                   String& authType,
109                   String& authRealm);
110           
111               String _getSubStringUptoMarker(
112                   const char** line,
113                   char marker);
114           
115 mike  1.2     Message* _requestMessage;    
116           
117               Boolean  _challengeReceived;
118           
119               String   _userName;
120           
121               String   _password;
122 kumpf 1.3 
123               String   _realm;
124 mike  1.2 
125               AuthType _authType;
126           };
127           
128           PEGASUS_NAMESPACE_END
129           
130           #endif /* Pegasus_ClientAuthenticator_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2