diff options
author | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-18 14:26:55 +0000 |
---|---|---|
committer | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-18 14:26:55 +0000 |
commit | 463f835f70fb2221cecf3b3e167f8beefef19068 (patch) | |
tree | 605cd2ecb86473ea641697ec58afe4c56bba2657 /net/http/http_auth_handler_basic.cc | |
parent | de9550d4a42650d0c40c2c554372bcc9de626c9d (diff) | |
download | chromium_src-463f835f70fb2221cecf3b3e167f8beefef19068.zip chromium_src-463f835f70fb2221cecf3b3e167f8beefef19068.tar.gz chromium_src-463f835f70fb2221cecf3b3e167f8beefef19068.tar.bz2 |
Check and invalidate cached credentials if they were used for preemptive authentication and were rejected by the server.
BUG=72589
TEST=net_unittests --gtest_filter=HttpAuthHandler*.HandleAnotherChallenge
Review URL: http://codereview.chromium.org/6525035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75390 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth_handler_basic.cc')
-rw-r--r-- | net/http/http_auth_handler_basic.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/net/http/http_auth_handler_basic.cc b/net/http/http_auth_handler_basic.cc index e48aa67..9ed28e2 100644 --- a/net/http/http_auth_handler_basic.cc +++ b/net/http/http_auth_handler_basic.cc @@ -53,9 +53,20 @@ bool HttpAuthHandlerBasic::ParseChallenge( HttpAuth::AuthorizationResult HttpAuthHandlerBasic::HandleAnotherChallenge( HttpAuth::ChallengeTokenizer* challenge) { - // Basic authentication is always a single round, so any responses should - // be treated as a rejection. - return HttpAuth::AUTHORIZATION_RESULT_REJECT; + // Basic authentication is always a single round, so any responses + // should be treated as a rejection. However, if the new challenge + // is for a different realm, then indicate the realm change. + HttpUtil::NameValuePairsIterator parameters = challenge->param_pairs(); + std::string realm; + while (parameters.GetNext()) { + if (LowerCaseEqualsASCII(parameters.name(), "realm")) { + realm = parameters.value(); + break; + } + } + return (realm_ != realm)? + HttpAuth::AUTHORIZATION_RESULT_DIFFERENT_REALM: + HttpAuth::AUTHORIZATION_RESULT_REJECT; } int HttpAuthHandlerBasic::GenerateAuthTokenImpl( |