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

  1 karl  1.26 //%2006////////////////////////////////////////////////////////////////////////
  2 mike  1.2  //
  3 karl  1.22 // 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.18 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.22 // 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.24 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.26 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 mike  1.2  //
 14 kumpf 1.7  // Permission is hereby granted, free of charge, to any person obtaining a copy
 15            // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18            // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20            // 
 21            // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29 mike  1.2  //
 30            //==============================================================================
 31            //
 32 kumpf 1.16 // Author:  Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
 33 mike  1.2  //
 34 kumpf 1.16 // Modified By: Jair Santos, Hewlett-Packard Company (jair.santos@hp.com)
 35 h.sterling 1.19 //              Heather Sterling, IBM (hsterl@us.ibm.com)
 36 mike       1.2  //
 37                 //%/////////////////////////////////////////////////////////////////////////////
 38                 
 39                 #ifndef Pegasus_AuthenticationInfo_h
 40                 #define Pegasus_AuthenticationInfo_h
 41                 
 42                 #include <Pegasus/Common/Config.h>
 43 kumpf      1.10 #include <Pegasus/Common/InternalException.h>
 44 kumpf      1.5  #include <Pegasus/Common/Tracer.h>
 45                 #include <Pegasus/Common/AuthenticationInfoRep.h>
 46 kumpf      1.8  #include <Pegasus/Common/Linkage.h>
 47 h.sterling 1.19 #include <Pegasus/Common/SSLContext.h>
 48 mike       1.2  
 49 gerarda    1.13 #ifdef PEGASUS_KERBEROS_AUTHENTICATION
 50 gerarda    1.15 #include <Pegasus/Common/CIMKerberosSecurityAssociation.h>
 51 gerarda    1.13 #endif
 52 mike       1.2  
 53                 PEGASUS_NAMESPACE_BEGIN
 54                 
 55 kumpf      1.5  
 56 mike       1.2  /**
 57                     This class keeps the authentication information of a connection 
 58 kumpf      1.5      persistent until the connection is destroyed. 
 59 mike       1.3  
 60 kumpf      1.5      The HTTPConnection object creates a AuthenticationInfo object on a new 
 61                     socket connection and includes this object reference in the HTTPMessage 
 62                     that gets passed to the Delegator and in turn to the AuthenticationManager.
 63                     The AuthenticationManager and the related authentication classes use the 
 64                     AuthenticationInfo to store and access the persistent authentication 
 65                     information for a connection.
 66 mike       1.2  */
 67                 class PEGASUS_COMMON_LINKAGE AuthenticationInfo
 68                 {
 69                 public:
 70                 
 71 kumpf      1.5      /** Constructor - Creates an uninitiated new AuthenticationInfo
 72                         object reprenting a AuthenticationInfo class. The class object 
 73                         created by this constructor can only be used in an operation such as the
 74                         copy constructor.  It cannot be used to do method calls like
 75                         setAuthStatus, getAuthType, etc. since it is unitiated.
 76                 
 77                         Use one of the other constructors to create an initiated new 
 78                         AuthenticationInfo class object. Throws an exception 
 79                         "unitialized handle" if this unitialized handle is used for 
 80                         method calls.
 81                     */
 82                     AuthenticationInfo() : _rep(0)
 83                     {
 84                         PEG_METHOD_ENTER(
 85                             TRC_AUTHENTICATION, "AuthenticationInfo::AuthenticationInfo");
 86                 
 87                 
 88                         PEG_METHOD_EXIT();
 89                     }
 90                 
 91                     /** Creates and instantiates a AuthenticationInfo from another 
 92 kumpf      1.5          AuthenticationInfo instance
 93                         @return pointer to the new AuthenticationInfo instance
 94                     */
 95                     AuthenticationInfo(const AuthenticationInfo& x)
 96                     {
 97                         PEG_METHOD_ENTER(
 98                             TRC_AUTHENTICATION, "AuthenticationInfo::AuthenticationInfo");
 99                 
100                         Inc(_rep = x._rep);
101                 
102                         PEG_METHOD_EXIT();
103                     }
104                 
105                     /** Assignment operator */
106                     AuthenticationInfo& operator=(const AuthenticationInfo& x)
107                     {
108                         PEG_METHOD_ENTER(
109                             TRC_AUTHENTICATION, "AuthenticationInfo::AuthenticationInfo");
110                 
111                         if (x._rep != _rep)
112                         {
113 kumpf      1.5              Dec(_rep);
114                             Inc(_rep = x._rep);
115                         }
116                 
117                         PEG_METHOD_EXIT();
118                         return *this;
119                     }
120                 
121                     /** Constructor - Instantiates a AuthenticationInfo object. 
122                     @param flag - used only to distinguish from the default constructor.
123                     */
124                     AuthenticationInfo(Boolean flag)
125                     {
126                         PEG_METHOD_ENTER(
127                             TRC_AUTHENTICATION, "AuthenticationInfo::AuthenticationInfo");
128 mike       1.2  
129 kumpf      1.5          _rep = new AuthenticationInfoRep(flag);
130                 
131                         PEG_METHOD_EXIT();
132                     }
133 mike       1.2  
134                     /** Destructor  */
135 kumpf      1.5      ~AuthenticationInfo()
136                     {
137                         PEG_METHOD_ENTER(
138                             TRC_AUTHENTICATION, "AuthenticationInfo::~AuthenticationInfo");
139                 
140                         Dec(_rep);
141                 
142                         PEG_METHOD_EXIT();
143                     }
144                 
145                     /** Get the authentication status of the request
146                         @return the current authentication status
147                     */
148                     AuthenticationInfoRep::AuthStatus getAuthStatus() const 
149                     { 
150                         _checkRep();
151                         return _rep->getAuthStatus(); 
152                     }
153                 
154                     /** Sets the authentication status of the request to the status
155                         specified.
156 kumpf      1.5          @param status - the new authentication status
157                     */
158                     void   setAuthStatus(AuthenticationInfoRep::AuthStatus status)
159                     { 
160                         _checkRep();
161                         _rep->setAuthStatus(status); 
162                     }
163                 
164                     /** Get the previously authenticated user name
165                         @return the authenticated user name
166                     */
167                     String getAuthenticatedUser() const 
168                     { 
169                         _checkRep();
170                         return _rep->getAuthenticatedUser(); 
171                     }
172                 
173                     /** Sets the authenticated user name
174                         @param userName - string containing the authenticated user name
175                     */
176                     void   setAuthenticatedUser(const String& userName)
177 kumpf      1.5      { 
178                         _checkRep();
179                         _rep->setAuthenticatedUser(userName); 
180                     }
181                 
182 kumpf      1.16     /** Get the previously authenticated password
183                         @return the authenticated password
184                     */
185                     String getAuthenticatedPassword() const 
186                     { 
187                         _checkRep();
188                         return _rep->getAuthenticatedPassword(); 
189                     }
190                 
191                     /** Sets the authenticated password
192                         @param password - string containing the authenticated password
193                     */
194                     void   setAuthenticatedPassword(const String& password)
195                     { 
196                         _checkRep();
197                         _rep->setAuthenticatedPassword(password); 
198                     }
199                     
200 kumpf      1.5      /** Get the authentication challenge that was sent to the client
201                         @return string containing the authentication challenge
202                     */
203                     String getAuthChallenge() const 
204                     { 
205                         _checkRep();
206                         return _rep->getAuthChallenge();
207                     }
208                 
209                     /** Sets the authentication challenge to the specified challenge
210                         @param challenge - string containing the authentication challenge
211                     */
212                     void   setAuthChallenge(const String& challenge)
213                     { 
214                         _checkRep();
215                         _rep->setAuthChallenge(challenge); 
216                     }
217                 
218                     /** Get the authentication secret that was sent to client
219                         @return string containing the authentication secret
220                     */
221 kumpf      1.5      String getAuthSecret() const 
222                     { 
223                         _checkRep();
224                         return _rep->getAuthSecret();
225                     }
226                 
227                     /** Set the authentication secret to the specified secret
228                         @param secret - string containing the authentication secret
229                     */
230                     void   setAuthSecret(const String& secret)
231                     { 
232                         _checkRep();
233                         _rep->setAuthSecret(secret); 
234                     }
235                 
236                     /** Returns the connection type of the previous authenticated request 
237                         @return true if the connection is privileged, false otherwise
238                     */
239                     Boolean isPrivileged() const 
240                     { 
241                         _checkRep();
242 kumpf      1.5          return _rep->isPrivileged();
243                     }
244                 
245                     /** Set the privileged flag to the specified value
246                         @param privileged - boolean flag indicating the connection type
247                     */
248                     void   setPrivileged(Boolean privileged)
249                     { 
250                         _checkRep();
251                         _rep->setPrivileged(privileged); 
252                     }
253                 
254                     /** Is the request authenticated
255                     */
256                     /** Returns the authentication status of the current connection.
257                         @return true if the connection was authenticated, false otherwise
258                     */
259                     Boolean isAuthenticated() const 
260                     { 
261                         _checkRep();
262                         return _rep->isAuthenticated();
263 kumpf      1.5      }
264                 
265                     /** Set the authentication type to the specified type
266                         @param string containing the authentication type
267                     */
268                     void   setAuthType(const String& authType)
269                     { 
270                         _checkRep();
271                         _rep->setAuthType(authType);
272                     }
273                 
274                     /** Get the authentication type of the connection
275                         @return string containing the authentication type
276                     */
277                     String getAuthType() const 
278                     { 
279                         _checkRep();
280                         return _rep->getAuthType();
281                     }
282 gerarda    1.13 
283                 #ifdef PEGASUS_KERBEROS_AUTHENTICATION
284                     /** Get the CIM Security Association 
285 gerarda    1.14         @return a pointer to the CIM Security Association
286 gerarda    1.13     */
287                     CIMKerberosSecurityAssociation* getSecurityAssociation() const 
288                     { 
289                         _checkRep();
290                         return _rep->getSecurityAssociation(); 
291 gerarda    1.14     }
292                 
293                     /** Set the CIM Security Association 
294                         The pointer will only be set once. If it is already set it will
295                         not reset it.
296                     */
297                     void setSecurityAssociation()
298                     { 
299                         _checkRep();
300 gerarda    1.17         _rep->setSecurityAssociation(); 
301 gerarda    1.13     }
302                 #endif
303 h.sterling 1.19 
304 kumpf      1.20     /** Indicate whether the export connection flag is set or not
305                     */
306                     Boolean isExportConnection() const
307                     {
308                         _checkRep();
309                         return _rep->isExportConnection();
310                     }
311                 
312                     /** Set the export connection flag
313                     */
314                     void setExportConnection(Boolean exportConnection)
315                     {
316                         _checkRep();
317                         _rep->setExportConnection(exportConnection);
318                     }
319                 
320 h.sterling 1.23 	//PEP187
321 h.sterling 1.25     Array<SSLCertificateInfo*> getClientCertificateChain()
322 h.sterling 1.23 	{
323                 	    _checkRep();
324 h.sterling 1.25         return _rep->getClientCertificateChain();
325 h.sterling 1.23 	}
326                 
327                 	//PEP187
328 h.sterling 1.25 	void setClientCertificateChain(Array<SSLCertificateInfo*> clientCertificate)
329 h.sterling 1.23 	{
330                         _checkRep();
331 h.sterling 1.25         _rep->setClientCertificateChain(clientCertificate);
332 h.sterling 1.23 	}
333                 
334 mike       1.2  private:
335                 
336 kumpf      1.5      AuthenticationInfo(AuthenticationInfoRep* rep) : _rep(rep)
337                     {
338 mike       1.2  
339 kumpf      1.5      }
340 mike       1.2  
341 kumpf      1.5      void _checkRep() const
342                     {
343                         if (!_rep)
344 kumpf      1.12             throw UninitializedObjectException();
345 kumpf      1.5      }
346 kumpf      1.4  
347 kumpf      1.5      AuthenticationInfoRep* _rep;
348 mike       1.2  };
349                 
350                 PEGASUS_NAMESPACE_END
351                 
352                 #endif   /* Pegasus_AuthenticationInfo_h*/

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2