(file) Return to PAMBasicAuthenticator.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Security / Authentication

  1 karl  1.9 //%2003////////////////////////////////////////////////////////////////////////
  2 kumpf 1.1 //
  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           // IBM Corp.; EMC Corporation, The Open Group.
  7 kumpf 1.1 //
  8 kumpf 1.4 // 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           // 
 15           // 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 kumpf 1.1 //
 24           //==============================================================================
 25           //
 26           // Author: Nag Boranna, Hewlett-Packard Company(nagaraja_boranna@hp.com)
 27           //
 28 kumpf 1.7 // Modified By: Yi Zhou, Hewlett-Packard Company(yi_zhou@hp.com)
 29 kumpf 1.8 //              Sushma Fernandes, Hewlett-Packard Company
 30           //                  (sushma_fernandes@hp.com)
 31 kumpf 1.1 //
 32           //%/////////////////////////////////////////////////////////////////////////////
 33           
 34           #ifndef Pegasus_PAMBasicAuthenticator_h
 35           #define Pegasus_PAMBasicAuthenticator_h
 36           
 37           #include <Pegasus/Common/Config.h>
 38 kumpf 1.8 #include <Pegasus/Common/IPC.h>
 39 kumpf 1.1 #include "BasicAuthenticator.h"
 40           
 41 kumpf 1.9.4.1 
 42 chuck 1.5     #include <Pegasus/Security/Authentication/Linkage.h>
 43 kumpf 1.1     
 44 kumpf 1.6     
 45 kumpf 1.1     PEGASUS_NAMESPACE_BEGIN
 46               
 47 kumpf 1.9.4.1 /** This class provides PAM basic authentication by communicating with a
 48                   standalone process.
 49               */
 50               
 51               #if defined(PEGASUS_USE_PAM_STANDALONE_PROC)
 52               
 53               class PEGASUS_SECURITY_LINKAGE PAMBasicAuthenticatorStandAlone
 54               {
 55               public:
 56               
 57                   /** constructor. */
 58                   PAMBasicAuthenticatorStandAlone();
 59               
 60                   /** destructor. */
 61                   ~PAMBasicAuthenticatorStandAlone();
 62               
 63                   /** Verify the authentication of the requesting user.
 64                       @param userName String containing the user name
 65                       @param password String containing the user password
 66                       @return true on successful authentication, false otherwise
 67                   */
 68 kumpf 1.9.4.1     Boolean authenticate(
 69                       const String& userName,
 70                       const String& password);
 71               
 72               private:
 73                   String        _realm;
 74               
 75                   Boolean _authenticateByPAM(
 76                       const String& userName,
 77                       const String& password);
 78               
 79                   void _createPAMStandalone();
 80               };
 81               
 82               #endif /* if defined(PEGASUS_USE_PAM_STANDALONE_PROC) */
 83               
 84 kumpf 1.1     /** This class provides PAM basic authentication implementation by extending
 85                   the BasicAuthenticator.
 86               */
 87               class PEGASUS_SECURITY_LINKAGE PAMBasicAuthenticator : public BasicAuthenticator
 88               {
 89               public:
 90               
 91                   /** constructor. */ 
 92                   PAMBasicAuthenticator();
 93               
 94                   /** destructor. */ 
 95                   ~PAMBasicAuthenticator();
 96               
 97                   /** Verify the authentication of the requesting user.
 98                       @param userName String containing the user name
 99                       @param password String containing the user password
100                       @return true on successful authentication, false otherwise
101                   */
102                   Boolean authenticate(
103                       const String& userName, 
104                       const String& password);
105 kumpf 1.1     
106                   /** Construct and return the HTTP Basic authentication challenge header
107                       @return A string containing the authentication challenge header.
108                   */
109                   String getAuthResponseHeader();
110               
111                   /** PAM Call back function, the pointer to this function is passed to the PAM module.
112                       @param num_msg int containing the message count
113                       @param msg pointer to a pam_message structure
114                       @param resp pointer to a pam_respone structure
115                       @param appdata_prt application data pointer
116                       @return PAM_SUCCESS on successful execution, a PAM error code otherwise
117                   */
118                   static Sint32 PAMCallback(
119                       Sint32 num_msg, 
120 kumpf 1.6     #if defined (PEGASUS_OS_LINUX) && defined(PEGASUS_PAM_AUTHENTICATION)
121               
122                       const struct pam_message **msg,
123               #else
124 kumpf 1.1             struct pam_message **msg,
125 kumpf 1.6     #endif
126 kumpf 1.1             struct pam_response **resp, 
127                       void *appdata_ptr);
128               
129               private:
130 kumpf 1.8         /**
131                       A mutex to serialize authentication calls.
132                   */
133                   static Mutex  _authSerializeMutex; 
134 kumpf 1.1     
135                   String        _realm;
136 kumpf 1.7     
137                   Boolean _authenticateByPAM(
138               	const String& userName,
139               	const String& password);
140               
141 kumpf 1.9.4.1 #if defined(PEGASUS_USE_PAM_STANDALONE_PROC)
142                   PAMBasicAuthenticatorStandAlone* _pamBasicAuthenticatorStandAlone;
143               #endif
144               
145 kumpf 1.1     };
146               
147               
148               PEGASUS_NAMESPACE_END
149               
150               #endif /* Pegasus_PAMBasicAuthenticator_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2