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

Issue 6525035: Invalidate credentials if the server rejects them. (Closed)

Created:
9 years, 10 months ago by asanka (google)
Modified:
9 years, 7 months ago
Reviewers:
cbentzel, asanka, wtc
CC:
chromium-reviews, pam+watch_chromium.org, cbentzel+watch_chromium.org, darin-cc_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

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 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=75390

Patch Set 1 #

Patch Set 2 : Simplify auth handlers for basic and digest #

Total comments: 1

Patch Set 3 : Simplify fix by only dealing with Basic and Digest auth. #

Patch Set 4 : Extra whitespace #

Total comments: 13

Patch Set 5 : Address issues, add new tests. #

Patch Set 6 : Don't invalidate cached credentials on rejected preemptive auth #

Patch Set 7 : Defer browser tests to another CL #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+84 lines, -25 lines) Patch
M net/http/http_auth.h View 1 2 1 chunk +7 lines, -0 lines 0 comments Download
M net/http/http_auth_controller.h View 1 2 3 4 2 chunks +7 lines, -1 line 2 comments Download
M net/http/http_auth_controller.cc View 1 2 3 4 5 6 3 chunks +18 lines, -14 lines 3 comments Download
M net/http/http_auth_handler_basic.cc View 1 2 3 1 chunk +14 lines, -3 lines 2 comments Download
M net/http/http_auth_handler_basic_unittest.cc View 1 2 3 4 1 chunk +19 lines, -0 lines 0 comments Download
M net/http/http_auth_handler_digest.cc View 1 2 3 4 1 chunk +12 lines, -7 lines 3 comments Download
M net/http/http_auth_handler_digest_unittest.cc View 1 2 3 4 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
asanka
For review.
9 years, 10 months ago (2011-02-16 15:39:13 UTC) #1
cbentzel
http://codereview.chromium.org/6525035/diff/1014/net/http/http_auth_controller.cc File net/http/http_auth_controller.cc (right): http://codereview.chromium.org/6525035/diff/1014/net/http/http_auth_controller.cc#newcode273 net/http/http_auth_controller.cc:273: case HttpAuth::AUTHORIZATION_RESULT_ACCEPT: Would it be cleaner if the new ...
9 years, 10 months ago (2011-02-16 16:13:05 UTC) #2
cbentzel
On Wed, Feb 16, 2011 at 11:13 AM, <cbentzel@chromium.org> wrote: > > > http://codereview.chromium.org/6525035/diff/1014/net/http/http_auth_controller.cc > ...
9 years, 10 months ago (2011-02-16 16:19:37 UTC) #3
asanka
On 2011/02/16 16:13:05, cbentzel wrote: > http://codereview.chromium.org/6525035/diff/1014/net/http/http_auth_controller.cc#newcode273 > net/http/http_auth_controller.cc:273: case > HttpAuth::AUTHORIZATION_RESULT_ACCEPT: > Would it ...
9 years, 10 months ago (2011-02-16 16:33:35 UTC) #4
cbentzel
On Wed, Feb 16, 2011 at 11:33 AM, <asanka@chromium.org> wrote: > On 2011/02/16 16:13:05, cbentzel ...
9 years, 10 months ago (2011-02-16 16:36:15 UTC) #5
asanka
On 2011/02/16 16:36:15, cbentzel wrote: > As you mentioned, I'm not even sure it's a ...
9 years, 10 months ago (2011-02-16 18:52:14 UTC) #6
asanka
Simplified patch by handling the realm test in HandleAnotherChallenge(). We do end up polluting the ...
9 years, 10 months ago (2011-02-16 19:50:33 UTC) #7
cbentzel
New code looks good, just some test comments. http://codereview.chromium.org/6525035/diff/8001/chrome/browser/ui/login/login_prompt_browsertest.cc File chrome/browser/ui/login/login_prompt_browsertest.cc (right): http://codereview.chromium.org/6525035/diff/8001/chrome/browser/ui/login/login_prompt_browsertest.cc#newcode71 chrome/browser/ui/login/login_prompt_browsertest.cc:71: void ...
9 years, 10 months ago (2011-02-16 20:51:39 UTC) #8
asanka
Added tests and addressed Chris' comments. http://codereview.chromium.org/6525035/diff/8001/chrome/browser/ui/login/login_prompt_browsertest.cc File chrome/browser/ui/login/login_prompt_browsertest.cc (right): http://codereview.chromium.org/6525035/diff/8001/chrome/browser/ui/login/login_prompt_browsertest.cc#newcode71 chrome/browser/ui/login/login_prompt_browsertest.cc:71: void LoginPromptBrowserTest::SetUpCommandLine(CommandLine* command_line) ...
9 years, 10 months ago (2011-02-16 22:39:19 UTC) #9
cbentzel
LGTM
9 years, 10 months ago (2011-02-16 22:43:54 UTC) #10
cbentzel
On 2011/02/16 22:43:54, cbentzel wrote: > LGTM As we discussed in person, it might make ...
9 years, 10 months ago (2011-02-17 12:05:42 UTC) #11
asanka
Deferred browser tests for another CL. Also added a check to the HttpAuthController::HandleAuthChallenge() for invalidating ...
9 years, 10 months ago (2011-02-17 14:51:19 UTC) #12
cbentzel
LGTM
9 years, 10 months ago (2011-02-17 20:53:41 UTC) #13
wtc
LGTM. I have some suggested changes and questions below. I didn't read the discussion between ...
9 years, 10 months ago (2011-02-22 23:17:32 UTC) #14
cbentzel
Thanks for the careful review. http://codereview.chromium.org/6525035/diff/14001/net/http/http_auth_controller.cc File net/http/http_auth_controller.cc (right): http://codereview.chromium.org/6525035/diff/14001/net/http/http_auth_controller.cc#newcode299 net/http/http_auth_controller.cc:299: // header. On 2011/02/22 ...
9 years, 10 months ago (2011-02-23 14:49:54 UTC) #15
asanka
9 years, 10 months ago (2011-02-23 18:06:40 UTC) #16
http://codereview.chromium.org/6525035/diff/14001/net/http/http_auth_controll...
File net/http/http_auth_controller.cc (right):

http://codereview.chromium.org/6525035/diff/14001/net/http/http_auth_controll...
net/http/http_auth_controller.cc:299: // header.
On 2011/02/22 23:17:32, wtc wrote:
> This comment is confusing because it seems self-contradictory.

I'll clarify the comment.

http://codereview.chromium.org/6525035/diff/14001/net/http/http_auth_controll...
File net/http/http_auth_controller.h (right):

http://codereview.chromium.org/6525035/diff/14001/net/http/http_auth_controll...
net/http/http_auth_controller.h:92: // Invalidates the current handler,
including cache.
On 2011/02/22 23:17:32, wtc wrote:
> IMPORTANT: please update the comment.  "including cache"
> is now true only if the 'action' argument is
> INVALIDATE_HANDLER_AND_CACHED_CREDENTIALS.

I'll fix this in another CL, since I already landed this one.

http://codereview.chromium.org/6525035/diff/14001/net/http/http_auth_handler_...
File net/http/http_auth_handler_basic.cc (right):

http://codereview.chromium.org/6525035/diff/14001/net/http/http_auth_handler_...
net/http/http_auth_handler_basic.cc:64: break;
On 2011/02/22 23:17:32, wtc wrote:
> Nit: this while loop should match the while loop in
> ParseChallenge (lines 41-45 exactly).
> 
> If multiple 'realm' parameters are present, that while loop
> takes the last one whereas this while loop takes the first
> one.

Will fix in a new CL.

> Your HttpAuthHandlerDigest::HandleAnotherChallenge doesn't
> have a 'break' statement in the while loop either.

In the Digest case, that was to give precedence to the "stale" directive if
there was one, but that has the side-effect of picking the last 'realm'
directive if there is more than one.

http://codereview.chromium.org/6525035/diff/14001/net/http/http_auth_handler_...
File net/http/http_auth_handler_digest.cc (right):

http://codereview.chromium.org/6525035/diff/14001/net/http/http_auth_handler_...
net/http/http_auth_handler_digest.cc:124: return
HttpAuth::AUTHORIZATION_RESULT_STALE;
On 2011/02/23 14:49:54, cbentzel wrote:
> On 2011/02/22 23:17:32, wtc wrote:
> > IMPORTANT: what if the new challenge has both stale=true
> > and a different realm?  Can that happen?
> 
> It could happen, but it seems unexpected. It seems like it would indicate that
> the specified realm has stale credentials - not the one that we previously
> issued a challenge for. I'll see if the RFC or httpbis mentions this corner
> case.

RFC 2617 states that the 'stale' value should only be set to 'true' if the
server "receives a request for which the nonce is invalid but with a valid
digest for that nonce (indicating that the client knows the correct
username/password)," and that the client "may wish to simply retry the request
with a new encrypted response, without reprompting the user for a new username
and password."

Based on that, I think giving precedence to the "stale=true" case and
disregarding a change in the realm is reasonable behavior.

Powered by Google App Engine
This is Rietveld 408576698