version 1.1.2.2, 2001/11/20 22:21:45
|
version 1.4, 2002/02/23 00:27:20
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <Pegasus/Common/Logger.h> | #include <Pegasus/Common/Logger.h> |
|
#include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Security/Authentication/SecureLocalAuthenticator.h> | #include <Pegasus/Security/Authentication/SecureLocalAuthenticator.h> |
#include "LocalAuthenticationHandler.h" | #include "LocalAuthenticationHandler.h" |
| |
|
|
| |
LocalAuthenticationHandler::LocalAuthenticationHandler() | LocalAuthenticationHandler::LocalAuthenticationHandler() |
{ | { |
|
const char METHOD_NAME[] = |
|
"LocalAuthenticationHandler::LocalAuthenticationHandler()"; |
|
|
|
PEG_FUNC_ENTER(TRC_AUTHENTICATION, METHOD_NAME); |
|
|
// ATTN: Load the local authentication module here | // ATTN: Load the local authentication module here |
| |
_localAuthenticator = (LocalAuthenticator*) new SecureLocalAuthenticator(); | _localAuthenticator = (LocalAuthenticator*) new SecureLocalAuthenticator(); |
|
|
|
PEG_FUNC_EXIT(TRC_AUTHENTICATION, METHOD_NAME); |
} | } |
| |
LocalAuthenticationHandler::~LocalAuthenticationHandler() | LocalAuthenticationHandler::~LocalAuthenticationHandler() |
{ | { |
|
const char METHOD_NAME[] = |
|
"LocalAuthenticationHandler::~LocalAuthenticationHandler()"; |
|
|
|
PEG_FUNC_ENTER(TRC_AUTHENTICATION, METHOD_NAME); |
|
|
|
PEG_FUNC_EXIT(TRC_AUTHENTICATION, METHOD_NAME); |
|
|
delete _localAuthenticator; | delete _localAuthenticator; |
} | } |
| |
Boolean LocalAuthenticationHandler::authenticate( | Boolean LocalAuthenticationHandler::authenticate( |
String authHeader, |
const String& authHeader, |
AuthenticationInfo* authInfo) | AuthenticationInfo* authInfo) |
{ | { |
|
const char METHOD_NAME[] = |
|
"LocalAuthenticationHandler::authenticate()"; |
|
|
|
PEG_FUNC_ENTER(TRC_AUTHENTICATION, METHOD_NAME); |
|
|
Boolean authenticated = false; | Boolean authenticated = false; |
| |
// Look for ':' seperator | // Look for ':' seperator |
|
|
| |
if ( colon1 == PEG_NOT_FOUND ) | if ( colon1 == PEG_NOT_FOUND ) |
{ | { |
|
PEG_FUNC_EXIT(TRC_AUTHENTICATION, METHOD_NAME); |
return ( authenticated ); | return ( authenticated ); |
} | } |
| |
|
|
// Look for another ':' seperator | // Look for another ':' seperator |
Uint32 colon2 = authHeader.find(colon1 + 1, ':'); | Uint32 colon2 = authHeader.find(colon1 + 1, ':'); |
| |
if ( colon1 == PEG_NOT_FOUND ) |
String filePath; |
|
|
|
String secretReceived; |
|
|
|
if ( colon2 == PEG_NOT_FOUND ) |
{ | { |
return ( authenticated ); |
filePath = String::EMPTY; |
} |
|
| |
String filePath = authHeader.subString( colon1 + 1, (colon2 - colon1 - 1) ); |
secretReceived = authHeader.subString( colon1 + 1 ); |
|
} |
|
else |
|
{ |
|
filePath = authHeader.subString( colon1 + 1, (colon2 - colon1 - 1) ); |
| |
String secretReceived = authHeader.subString( colon2 + 1 ); |
secretReceived = authHeader.subString( colon2 + 1 ); |
|
} |
| |
authenticated = _localAuthenticator->authenticate(filePath, | authenticated = _localAuthenticator->authenticate(filePath, |
secretReceived, authInfo->getAuthChallenge()); | secretReceived, authInfo->getAuthChallenge()); |
|
|
authInfo->setAuthenticatedUser(userName); | authInfo->setAuthenticatedUser(userName); |
} | } |
| |
|
PEG_FUNC_EXIT(TRC_AUTHENTICATION, METHOD_NAME); |
|
|
return ( authenticated ); | return ( authenticated ); |
} | } |
| |
String LocalAuthenticationHandler::getAuthResponseHeader( | String LocalAuthenticationHandler::getAuthResponseHeader( |
String userName, |
const String& authHeader, |
|
AuthenticationInfo* authInfo) |
|
{ |
|
const char METHOD_NAME[] = |
|
"LocalAuthenticationHandler::getAuthResponseHeader()"; |
|
|
|
PEG_FUNC_ENTER(TRC_AUTHENTICATION, METHOD_NAME); |
|
|
|
PEG_FUNC_EXIT(TRC_AUTHENTICATION, METHOD_NAME); |
|
|
|
// |
|
// No Implementation required in LocalAuthenticationHandler |
|
// |
|
return(String("")); |
|
} |
|
|
|
String LocalAuthenticationHandler::getAuthResponseHeader( |
|
const String& authType, |
|
const String& userName, |
AuthenticationInfo* authInfo) | AuthenticationInfo* authInfo) |
{ | { |
|
const char METHOD_NAME[] = |
|
"LocalAuthenticationHandler::getAuthResponseHeader()"; |
|
|
|
PEG_FUNC_ENTER(TRC_AUTHENTICATION, METHOD_NAME); |
|
|
String challenge; | String challenge; |
| |
String authResp = _localAuthenticator->getAuthResponseHeader(userName, challenge); |
String authResp = |
|
_localAuthenticator->getAuthResponseHeader(authType, userName, challenge); |
| |
authInfo->setAuthChallenge(challenge); | authInfo->setAuthChallenge(challenge); |
| |
|
PEG_FUNC_EXIT(TRC_AUTHENTICATION, METHOD_NAME); |
|
|
return(authResp); | return(authResp); |
} | } |
| |