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

Unified Diff: net/http/http_auth_controller.cc

Issue 2489883007: [net/auth] Discard current handler token generation fails. (Closed)
Patch Set: Missed a few comments in the last round. Created 4 years, 1 month 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/http/http_auth_controller.h ('k') | net/http/http_auth_handler_mock.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_controller.cc
diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc
index 78e5a0354beec639b911260a6b9621ba2aeeb727..01245a9b8c7f9af7f94e306302740518ef6450c3 100644
--- a/net/http/http_auth_controller.cc
+++ b/net/http/http_auth_controller.cc
@@ -156,7 +156,8 @@ int HttpAuthController::MaybeGenerateAuthToken(
DCHECK(callback_.is_null());
int rv = handler_->GenerateAuthToken(
credentials, request,
- base::Bind(&HttpAuthController::OnIOComplete, base::Unretained(this)),
+ base::Bind(&HttpAuthController::OnGenerateAuthTokenDone,
+ base::Unretained(this)),
&auth_token_);
if (rv == ERR_IO_PENDING) {
@@ -481,8 +482,10 @@ int HttpAuthController::HandleGenerateTokenResult(int result) {
// 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.
+ // The current handler may be tied to external state that is no longer
+ // valid, hence should be discarded. Since the scheme is still valid, a
+ // new handler can be created for the current scheme.
+ InvalidateCurrentHandler(INVALIDATE_HANDLER_AND_CACHED_CREDENTIALS);
auth_token_.clear();
return OK;
@@ -503,7 +506,7 @@ int HttpAuthController::HandleGenerateTokenResult(int result) {
// In these cases, disable the current scheme as it cannot
// succeed.
- DisableAuthScheme(handler_->auth_scheme());
+ InvalidateCurrentHandler(INVALIDATE_HANDLER_AND_DISABLE_SCHEME);
auth_token_.clear();
return OK;
@@ -512,7 +515,7 @@ int HttpAuthController::HandleGenerateTokenResult(int result) {
}
}
-void HttpAuthController::OnIOComplete(int result) {
+void HttpAuthController::OnGenerateAuthTokenDone(int result) {
DCHECK(CalledOnValidThread());
result = HandleGenerateTokenResult(result);
if (!callback_.is_null()) {
« no previous file with comments | « net/http/http_auth_controller.h ('k') | net/http/http_auth_handler_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698