version 1.43, 2013/05/28 12:34:24
|
version 1.44, 2013/06/05 14:09:26
|
|
|
// | // |
// Perform http authentication | // Perform http authentication |
// | // |
Boolean AuthenticationManager::performHttpAuthentication( |
AuthenticationStatus AuthenticationManager::performHttpAuthentication( |
const String& authHeader, | const String& authHeader, |
AuthenticationInfo* authInfo) | AuthenticationInfo* authInfo) |
{ | { |
|
|
"Malformed HTTP authentication header: %s", | "Malformed HTTP authentication header: %s", |
(const char*)authHeader.getCString())); | (const char*)authHeader.getCString())); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return false; |
return AuthenticationStatus(AUTHSC_UNAUTHORIZED); |
} | } |
| |
Boolean authenticated = false; |
AuthenticationStatus authStatus(AUTHSC_UNAUTHORIZED); |
| |
// | // |
// Check the authenticationinformation and do the authentication | // Check the authenticationinformation and do the authentication |
|
|
if ( String::equalNoCase(authType, "Basic") && | if ( String::equalNoCase(authType, "Basic") && |
String::equal(_httpAuthType, "Basic") ) | String::equal(_httpAuthType, "Basic") ) |
{ | { |
authenticated = _httpAuthHandler->authenticate(cookie, authInfo); |
authStatus = _httpAuthHandler->authenticate(cookie, authInfo); |
} | } |
#ifdef PEGASUS_KERBEROS_AUTHENTICATION | #ifdef PEGASUS_KERBEROS_AUTHENTICATION |
else if ( String::equalNoCase(authType, "Negotiate") && | else if ( String::equalNoCase(authType, "Negotiate") && |
String::equal(_httpAuthType, "Kerberos") ) | String::equal(_httpAuthType, "Kerberos") ) |
{ | { |
authenticated = _httpAuthHandler->authenticate(cookie, authInfo); |
authStatus = _httpAuthHandler->authenticate(cookie, authInfo); |
} | } |
#endif | #endif |
// FUTURE: Add code to check for "Digest" when digest | // FUTURE: Add code to check for "Digest" when digest |
// authentication is implemented. | // authentication is implemented. |
| |
if ( authenticated ) |
if ( authStatus.isSuccess() ) |
{ | { |
authInfo->setAuthType(authType); | authInfo->setAuthType(authType); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
return authenticated; |
return authStatus; |
} | } |
| |
// | // |
// Perform pegasus sepcific local authentication | // Perform pegasus sepcific local authentication |
// | // |
Boolean AuthenticationManager::performPegasusAuthentication( |
AuthenticationStatus AuthenticationManager::performPegasusAuthentication( |
const String& authHeader, | const String& authHeader, |
AuthenticationInfo* authInfo) | AuthenticationInfo* authInfo) |
{ | { |
PEG_METHOD_ENTER(TRC_AUTHENTICATION, | PEG_METHOD_ENTER(TRC_AUTHENTICATION, |
"AuthenticationManager::performPegasusAuthentication()"); | "AuthenticationManager::performPegasusAuthentication()"); |
| |
Boolean authenticated = false; |
AuthenticationStatus authStatus(AUTHSC_UNAUTHORIZED); |
| |
String authType; | String authType; |
String userName; | String userName; |
|
|
"Malformed Pegasus authentication header: %s", | "Malformed Pegasus authentication header: %s", |
(const char*)authHeader.getCString())); | (const char*)authHeader.getCString())); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return false; |
return AuthenticationStatus(AUTHSC_UNAUTHORIZED); |
} | } |
| |
// The HTTPAuthenticatorDelegator ensures only local authentication | // The HTTPAuthenticatorDelegator ensures only local authentication |
// requests get here. | // requests get here. |
PEGASUS_ASSERT(authType == "Local"); | PEGASUS_ASSERT(authType == "Local"); |
| |
authenticated = |
authStatus = _localAuthHandler->authenticate(cookie, authInfo); |
_localAuthHandler->authenticate(cookie, authInfo); |
|
| |
if ( authenticated ) |
if ( authStatus.isSuccess() ) |
{ | { |
authInfo->setAuthType(authType); | authInfo->setAuthType(authType); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
return authenticated; |
return authStatus; |
} | } |
| |
// | // |
// Validate user. | // Validate user. |
// | // |
Boolean AuthenticationManager::validateUserForHttpAuth( |
AuthenticationStatus AuthenticationManager::validateUserForHttpAuth( |
const String& userName, | const String& userName, |
AuthenticationInfo* authInfo) | AuthenticationInfo* authInfo) |
{ | { |