-
Notifications
You must be signed in to change notification settings - Fork 960
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from jsternberg/digest-auth-multiple-headers
Fix digest auth when multiple headers are sent by the server
- Loading branch information
Showing
2 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,4 +112,41 @@ def authorization_header | |
authorization_header.should include(%Q(response="#{request_digest}")) | ||
end | ||
end | ||
|
||
context "with multiple authenticate headers" do | ||
before do | ||
@digest = setup_digest({ | ||
'www-authenticate' => 'NTLM, Digest realm="[email protected]", nonce="NONCE", qop="auth"', | ||
}) | ||
end | ||
|
||
it "should set prefix" do | ||
authorization_header.should =~ /^Digest / | ||
end | ||
|
||
it "should set username" do | ||
authorization_header.should include(%Q(username="Mufasa")) | ||
end | ||
|
||
it "should set digest-uri" do | ||
authorization_header.should include(%Q(uri="/dir/index.html")) | ||
end | ||
|
||
it "should set qop" do | ||
authorization_header.should include(%Q(qop="auth")) | ||
end | ||
|
||
it "should set cnonce" do | ||
authorization_header.should include(%Q(cnonce="md5(deadbeef)")) | ||
end | ||
|
||
it "should set nonce-count" do | ||
authorization_header.should include(%Q(nc=00000001)) | ||
end | ||
|
||
it "should set response" do | ||
request_digest = "md5(md5(Mufasa:[email protected]:Circle Of Life):NONCE:00000001:md5(deadbeef):auth:md5(GET:/dir/index.html))" | ||
authorization_header.should include(%Q(response="#{request_digest}")) | ||
end | ||
end | ||
end |