Index: net/http/http_auth_handler_negotiate.cc |
diff --git a/net/http/http_auth_handler_negotiate.cc b/net/http/http_auth_handler_negotiate.cc |
index afaa3f01e30daee310b79552bf92947221f9b7b4..46103193cda56c337a4ec81dbe4ea94b4af6cba4 100644 |
--- a/net/http/http_auth_handler_negotiate.cc |
+++ b/net/http/http_auth_handler_negotiate.cc |
@@ -38,7 +38,7 @@ void HttpAuthHandlerNegotiate::Factory::set_host_resolver( |
} |
int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler( |
- HttpAuthChallengeTokenizer* challenge, |
+ const HttpAuthChallengeTokenizer& challenge, |
HttpAuth::Target target, |
const GURL& origin, |
CreateReason reason, |
@@ -84,10 +84,11 @@ int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler( |
resolver_, disable_cname_lookup_, |
use_port_)); |
#endif |
- if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
- return ERR_INVALID_RESPONSE; |
- handler->swap(tmp_handler); |
- return OK; |
+ int result = |
+ tmp_handler->HandleInitialChallenge(challenge, target, origin, net_log); |
+ if (result == OK) |
+ handler->swap(tmp_handler); |
+ return result; |
} |
HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate( |
@@ -168,7 +169,7 @@ std::string HttpAuthHandlerNegotiate::CreateSPN( |
} |
HttpAuth::AuthorizationResult HttpAuthHandlerNegotiate::HandleAnotherChallenge( |
- HttpAuthChallengeTokenizer* challenge) { |
+ const HttpAuthChallengeTokenizer& challenge) { |
return auth_system_.ParseChallenge(challenge); |
} |
@@ -191,30 +192,35 @@ bool HttpAuthHandlerNegotiate::AllowsExplicitCredentials() { |
// The Negotiate challenge header looks like: |
// WWW-Authenticate: NEGOTIATE auth-data |
-bool HttpAuthHandlerNegotiate::Init(HttpAuthChallengeTokenizer* challenge) { |
+int HttpAuthHandlerNegotiate::Init( |
+ const HttpAuthChallengeTokenizer& challenge) { |
#if defined(OS_POSIX) |
if (!auth_system_.Init()) { |
VLOG(1) << "can't initialize GSSAPI library"; |
- return false; |
+ return ERR_UNSUPPORTED_AUTH_SCHEME; |
} |
// GSSAPI does not provide a way to enter username/password to |
// obtain a TGT. If the default credentials are not allowed for |
// a particular site (based on whitelist), fall back to a |
// different scheme. |
if (!AllowsDefaultCredentials()) |
- return false; |
+ return ERR_UNSUPPORTED_AUTH_SCHEME; |
#endif |
if (CanDelegate()) |
auth_system_.Delegate(); |
auth_scheme_ = "negotiate"; |
HttpAuth::AuthorizationResult auth_result = |
auth_system_.ParseChallenge(challenge); |
- return (auth_result == HttpAuth::AUTHORIZATION_RESULT_ACCEPT); |
+ return auth_result == HttpAuth::AUTHORIZATION_RESULT_ACCEPT |
+ ? OK |
+ : ERR_INVALID_RESPONSE; |
} |
int HttpAuthHandlerNegotiate::GenerateAuthTokenImpl( |
- const AuthCredentials* credentials, const HttpRequestInfo* request, |
- const CompletionCallback& callback, std::string* auth_token) { |
+ const AuthCredentials* credentials, |
+ const HttpRequestInfo& request, |
+ const CompletionCallback& callback, |
+ std::string* auth_token) { |
DCHECK(callback_.is_null()); |
DCHECK(auth_token_ == NULL); |
auth_token_ = auth_token; |