version 1.11, 2003/04/02 20:14:43
|
version 1.12, 2003/08/02 19:17:06
|
|
|
#include "BasicAuthenticationHandler.h" | #include "BasicAuthenticationHandler.h" |
#include "AuthenticationManager.h" | #include "AuthenticationManager.h" |
| |
|
#ifdef PEGASUS_KERBEROS_AUTHENTICATION |
|
#include "KerberosAuthenticationHandler.h" |
|
#endif |
|
|
|
|
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
{ | { |
authenticated = _httpAuthHandler->authenticate(cookie, authInfo); | authenticated = _httpAuthHandler->authenticate(cookie, authInfo); |
} | } |
|
#ifdef PEGASUS_KERBEROS_AUTHENTICATION |
|
else if ( String::equalNoCase(authType, "Negotiate") && |
|
String::equalNoCase(_httpAuthType, "Kerberos") ) |
|
{ |
|
authenticated = _httpAuthHandler->authenticate(cookie, authInfo); |
|
} |
|
#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. |
| |
|
|
// | // |
// Get HTTP authentication response header | // Get HTTP authentication response header |
// | // |
|
#ifdef PEGASUS_KERBEROS_AUTHENTICATION |
|
String AuthenticationManager::getHttpAuthResponseHeader( AuthenticationInfo* authInfo ) |
|
#else |
String AuthenticationManager::getHttpAuthResponseHeader() | String AuthenticationManager::getHttpAuthResponseHeader() |
|
#endif |
{ | { |
PEG_METHOD_ENTER( | PEG_METHOD_ENTER( |
TRC_AUTHENTICATION, "AuthenticationManager::getHttpAuthResponseHeader()"); | TRC_AUTHENTICATION, "AuthenticationManager::getHttpAuthResponseHeader()"); |
| |
|
#ifdef PEGASUS_KERBEROS_AUTHENTICATION |
|
String respHeader = _httpAuthHandler->getAuthResponseHeader( |
|
String::EMPTY, String::EMPTY, authInfo); |
|
#else |
String respHeader = _httpAuthHandler->getAuthResponseHeader(); | String respHeader = _httpAuthHandler->getAuthResponseHeader(); |
|
#endif |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
|
|
{ | { |
handler = (Authenticator* ) new BasicAuthenticationHandler( ); | handler = (Authenticator* ) new BasicAuthenticationHandler( ); |
} | } |
|
#ifdef PEGASUS_KERBEROS_AUTHENTICATION |
|
else if ( String::equalNoCase(_httpAuthType, "Kerberos") ) |
|
{ |
|
handler = (Authenticator* ) new KerberosAuthenticationHandler( ); |
|
KerberosAuthenticationHandler* kerberosHandler = (KerberosAuthenticationHandler *)handler; |
|
int itFailed = kerberosHandler->initialize(); |
|
if (itFailed) |
|
{ |
|
if (handler) |
|
{ |
|
delete handler; // cleanup |
|
handler = 0; |
|
} |
|
PEGASUS_ASSERT(0); // end the server because Kerberos could not |
|
// initialized. will this really end the server? |
|
} |
|
} |
|
#endif |
// FUTURE: uncomment these line when Digest authentication | // FUTURE: uncomment these line when Digest authentication |
// is implemented. | // is implemented. |
// | // |