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

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 a nit I had missed. Created 5 years, 6 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..739f4ceab4a79e3b0f9fe5a0b89f821e9b033345 100644
--- a/net/http/http_auth_handler_negotiate.cc
+++ b/net/http/http_auth_handler_negotiate.cc
@@ -65,6 +65,19 @@ int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler(
return ERR_INVALID_RESPONSE;
handler->swap(tmp_handler);
return OK;
+#elif defined(OS_ANDROID)
+ if (is_unsupported_ || account_type_.empty())
+ return ERR_UNSUPPORTED_AUTH_SCHEME;
+ // TODO(ahendrickson): Move towards model of parsing in the factory
+ // method and only constructing when valid.
+ scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNegotiate(
+ account_type_, 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_POSIX)
if (is_unsupported_)
return ERR_UNSUPPORTED_AUTH_SCHEME;
@@ -86,7 +99,11 @@ int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler(
}
HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate(
+#if defined(OS_ANDROID)
+ std::string account_type,
+#else
AuthLibrary* auth_library,
+#endif
#if defined(OS_WIN)
ULONG max_token_length,
#endif
@@ -94,7 +111,9 @@ HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate(
HostResolver* resolver,
bool disable_cname_lookup,
bool use_port)
-#if defined(OS_WIN)
+#if defined(OS_ANDROID)
+ : auth_system_(account_type, "Negotiate"),
+#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),
@@ -316,7 +335,10 @@ int HttpAuthHandlerNegotiate::DoGenerateAuthToken() {
next_state_ = STATE_GENERATE_AUTH_TOKEN_COMPLETE;
AuthCredentials* credentials = has_credentials_ ? &credentials_ : NULL;
// TODO(cbentzel): This should possibly be done async.
cbentzel 2015/06/11 20:51:43 Looks like this TODO can be removed :)
aberent 2015/06/15 15:52:20 Done. Although this code now supports asynchronous
- 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