Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Unified Diff: net/http/http_auth_handler_negotiate.cc

Issue 1128043007: Support Kerberos on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix cbentzel@'s nits Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 422ddd729a27cf4dc9c24198c4dc30e0087cd60c..b02913b8024f01a704c687bcec6d2a05a59b5f74 100644
--- a/net/http/http_auth_handler_negotiate.cc
+++ b/net/http/http_auth_handler_negotiate.cc
@@ -61,10 +61,14 @@ int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler(
new HttpAuthHandlerNegotiate(auth_library_.get(), max_token_length_,
url_security_manager(), resolver_,
disable_cname_lookup_, use_port_));
- if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log))
- return ERR_INVALID_RESPONSE;
- handler->swap(tmp_handler);
- return OK;
+#elif defined(OS_ANDROID)
+ if (is_unsupported_ || auth_library_->empty() || reason == CREATE_PREEMPTIVE)
+ return ERR_UNSUPPORTED_AUTH_SCHEME;
+ // TODO(cbentzel): Move towards model of parsing in the factory
+ // method and only constructing when valid.
+ scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNegotiate(
+ auth_library_.get(), url_security_manager(), resolver_,
+ disable_cname_lookup_, use_port_));
#elif defined(OS_POSIX)
if (is_unsupported_)
return ERR_UNSUPPORTED_AUTH_SCHEME;
@@ -78,11 +82,11 @@ int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler(
new HttpAuthHandlerNegotiate(auth_library_.get(), url_security_manager(),
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;
-#endif
}
HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate(
@@ -94,7 +98,9 @@ HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate(
HostResolver* resolver,
bool disable_cname_lookup,
bool use_port)
-#if defined(OS_WIN)
+#if defined(OS_ANDROID)
+ : auth_system_(*auth_library),
+#elif defined(OS_WIN)
: auth_system_(auth_library, "Negotiate", NEGOSSP_NAME, max_token_length),
#elif defined(OS_POSIX)
: auth_system_(auth_library, "Negotiate", CHROME_GSS_SPNEGO_MECH_OID_DESC),
@@ -315,8 +321,10 @@ int HttpAuthHandlerNegotiate::DoResolveCanonicalNameComplete(int rv) {
int HttpAuthHandlerNegotiate::DoGenerateAuthToken() {
next_state_ = STATE_GENERATE_AUTH_TOKEN_COMPLETE;
AuthCredentials* credentials = has_credentials_ ? &credentials_ : NULL;
- // TODO(cbentzel): This should possibly be done async.
- return auth_system_.GenerateAuthToken(credentials, spn_, auth_token_);
+ return auth_system_.GenerateAuthToken(
+ credentials, spn_, auth_token_,
+ base::Bind(&HttpAuthHandlerNegotiate::OnIOComplete,
+ base::Unretained(this)));
}
int HttpAuthHandlerNegotiate::DoGenerateAuthTokenComplete(int rv) {

Powered by Google App Engine
This is Rietveld 408576698