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

Unified Diff: net/android/http_auth_negotiate_android.cc

Issue 1414313002: Allow dynamic updating of authentication policies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to cbentzel@'s comments. Created 5 years 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
« no previous file with comments | « net/android/http_auth_negotiate_android.h ('k') | net/android/http_auth_negotiate_android_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/android/http_auth_negotiate_android.cc
diff --git a/net/android/http_auth_negotiate_android.cc b/net/android/http_auth_negotiate_android.cc
index feae16a9fa07ed4585bb1a5331455136474df856..907cff3aec8871f81652feff08f4e62b6cd420d2 100644
--- a/net/android/http_auth_negotiate_android.cc
+++ b/net/android/http_auth_negotiate_android.cc
@@ -15,6 +15,7 @@
#include "net/base/net_errors.h"
#include "net/http/http_auth_challenge_tokenizer.h"
#include "net/http/http_auth_multi_round_parse.h"
+#include "net/http/http_auth_preferences.h"
using base::android::AttachCurrentThread;
using base::android::ConvertUTF8ToJavaString;
@@ -54,16 +55,17 @@ void JavaNegotiateResultWrapper::SetResult(JNIEnv* env,
}
HttpAuthNegotiateAndroid::HttpAuthNegotiateAndroid(
- const std::string& account_type)
- : account_type_(account_type),
+ const HttpAuthPreferences* prefs)
+ : prefs_(prefs),
can_delegate_(false),
first_challenge_(true),
auth_token_(nullptr),
weak_factory_(this) {
- DCHECK(!account_type.empty());
JNIEnv* env = AttachCurrentThread();
java_authenticator_.Reset(Java_HttpNegotiateAuthenticator_create(
- env, ConvertUTF8ToJavaString(env, account_type).obj()));
+ env,
+ ConvertUTF8ToJavaString(env, prefs->AuthAndroidNegotiateAccountType())
+ .obj()));
}
HttpAuthNegotiateAndroid::~HttpAuthNegotiateAndroid() {
@@ -101,6 +103,11 @@ int HttpAuthNegotiateAndroid::GenerateAuthToken(
const std::string& spn,
std::string* auth_token,
const net::CompletionCallback& callback) {
+ if (prefs_->AuthAndroidNegotiateAccountType().empty()) {
+ // This can happen if there is a policy change, removing the account type,
+ // in the middle of a negotiation.
+ return ERR_UNSUPPORTED_AUTH_SCHEME;
+ }
DCHECK(auth_token);
DCHECK(completion_callback_.is_null());
DCHECK(!callback.is_null());
@@ -117,7 +124,7 @@ int HttpAuthNegotiateAndroid::GenerateAuthToken(
ConvertUTF8ToJavaString(env, server_auth_token_);
ScopedJavaLocalRef<jstring> java_spn = ConvertUTF8ToJavaString(env, spn);
ScopedJavaLocalRef<jstring> java_account_type =
- ConvertUTF8ToJavaString(env, account_type_);
+ ConvertUTF8ToJavaString(env, prefs_->AuthAndroidNegotiateAccountType());
// It is intentional that callback_wrapper is not owned or deleted by the
// HttpAuthNegotiateAndroid object. The Java code will call the callback
« no previous file with comments | « net/android/http_auth_negotiate_android.h ('k') | net/android/http_auth_negotiate_android_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698