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

Unified Diff: net/http/http_auth_controller.cc

Issue 2382293004: [net/auth] Don't abort network transaction over non-permanent auth errors. (Closed)
Patch Set: Created 4 years, 3 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_controller.cc
diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc
index 15725b44b9f0dd8cf480d6fd0454c65194333cb5..b2cd4146832ec61ccbaebcfffe380987cb5a5c29 100644
--- a/net/http/http_auth_controller.cc
+++ b/net/http/http_auth_controller.cc
@@ -158,8 +158,7 @@ int HttpAuthController::MaybeGenerateAuthToken(
credentials, request,
base::Bind(&HttpAuthController::OnIOComplete, base::Unretained(this)),
&auth_token_);
- if (DisableOnAuthHandlerResult(rv))
- rv = OK;
+ rv = HandleGenerateTokenResult(rv);
if (rv == ERR_IO_PENDING)
callback_ = callback;
else
@@ -471,10 +470,21 @@ void HttpAuthController::PopulateAuthChallenge() {
auth_info_->realm = handler_->realm();
}
-bool HttpAuthController::DisableOnAuthHandlerResult(int result) {
+int HttpAuthController::HandleGenerateTokenResult(int result) {
DCHECK(CalledOnValidThread());
-
switch (result) {
+ case ERR_INVALID_AUTH_CREDENTIALS:
+ // If the GenerateAuthToken call fails with this error, this means that
+ // the handler can no longer be used. However, the authentication scheme
+ // is considered still usable. This allows a scheme that attempted and
+ // failed to use default credentials to recover and use explicit
+ // credentials.
+ //
+ // If the handler does not support any remaining identity sources, then
+ // the authentication controller will pick another authentication handler.
+ auth_token_.clear();
+ return OK;
mmenke 2016/10/04 19:42:14 So this makes us send a new request, without a tok
asanka 2016/10/06 14:16:35 Either an error displayed to the user, or dependin
+
// Occurs with GSSAPI, if the user has not already logged in.
case ERR_MISSING_AUTH_CREDENTIALS:
mmenke 2016/10/04 19:42:14 We get ERR_INVALID_AUTH_CREDENTIALS instead of ERR
asanka 2016/10/06 14:16:35 Initially we ask the system whether we can initiat
@@ -494,17 +504,16 @@ bool HttpAuthController::DisableOnAuthHandlerResult(int result) {
// succeed.
DisableAuthScheme(handler_->auth_scheme());
auth_token_.clear();
- return true;
+ return OK;
default:
- return false;
+ return result;
}
}
void HttpAuthController::OnIOComplete(int result) {
DCHECK(CalledOnValidThread());
- if (DisableOnAuthHandlerResult(result))
- result = OK;
+ result = HandleGenerateTokenResult(result);
if (!callback_.is_null()) {
CompletionCallback c = callback_;
callback_.Reset();

Powered by Google App Engine
This is Rietveld 408576698