version 1.1, 2013/05/28 12:36:51
|
version 1.1.2.4, 2013/11/21 17:59:46
|
|
|
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
#include "PAMSessionBasicAuthenticator.h" | #include "PAMSessionBasicAuthenticator.h" |
#include "PAMSession.h" | #include "PAMSession.h" |
|
#include "pam_rcToAuthStatus.h" |
| |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
| |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
Boolean PAMSessionBasicAuthenticator::authenticate( |
AuthenticationStatus PAMSessionBasicAuthenticator::authenticate( |
const String& userName, | const String& userName, |
const String& password, | const String& password, |
AuthenticationInfo* authInfo) | AuthenticationInfo* authInfo) |
|
|
PEG_METHOD_ENTER(TRC_AUTHENTICATION, | PEG_METHOD_ENTER(TRC_AUTHENTICATION, |
"PAMSessionBasicAuthenticator::authenticate()"); | "PAMSessionBasicAuthenticator::authenticate()"); |
| |
if (PAM_SUCCESS != _PAMAuthenticate( |
int pamRC = _PAMAuthenticate( |
userName.getCString(), | userName.getCString(), |
password.getCString(), | password.getCString(), |
authInfo)) |
authInfo); |
|
|
|
AuthenticationStatus authStatus = _getAuthStatusFromPAM_RC(pamRC); |
|
|
|
// in case of an expired password, store user authenticated password |
|
if (authStatus.isPasswordExpired()) |
{ | { |
PEG_METHOD_EXIT(); |
authInfo->setAuthenticatedPassword(password); |
return false; |
authInfo->setAuthenticatedUser(userName); |
|
authInfo->setExpiredPassword(true); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return true; |
return authStatus; |
} | } |
| |
Boolean PAMSessionBasicAuthenticator::validateUser( |
AuthenticationStatus PAMSessionBasicAuthenticator::validateUser( |
const String& userName, | const String& userName, |
AuthenticationInfo* authInfo) | AuthenticationInfo* authInfo) |
{ | { |
PEG_METHOD_ENTER(TRC_AUTHENTICATION, | PEG_METHOD_ENTER(TRC_AUTHENTICATION, |
"PAMSessionBasicAuthenticator::validateUser()"); | "PAMSessionBasicAuthenticator::validateUser()"); |
| |
if (PAM_SUCCESS != _PAMValidateUser( |
int pamRC = _PAMValidateUser(userName.getCString(), authInfo); |
userName.getCString(), |
AuthenticationStatus authStatus = _getAuthStatusFromPAM_RC(pamRC); |
authInfo)) |
|
{ |
|
PEG_METHOD_EXIT(); |
|
return false; |
|
} |
|
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return true; |
return authStatus; |
} | } |
| |
| |
|
|
return responseHeader; | return responseHeader; |
} | } |
| |
|
AuthenticationStatus PAMSessionBasicAuthenticator::updateExpiredPassword( |
|
const String& userName, |
|
const String& oldPass, |
|
const String& newPass, |
|
const String& ipAddress) |
|
{ |
|
PEG_METHOD_ENTER(TRC_AUTHENTICATION, |
|
"PAMSessionBasicAuthenticator::updateExpiredPassword()"); |
|
|
|
int pamRC = _PAMUpdateExpiredPassword( |
|
userName.getCString(), |
|
oldPass.getCString(), |
|
newPass.getCString(), |
|
ipAddress.getCString()); |
|
|
|
AuthenticationStatus authStatus = _getAuthStatusFromPAM_RC(pamRC); |
|
|
|
PEG_METHOD_EXIT(); |
|
return authStatus; |
|
} |
|
|
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |