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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2