aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/http_digest_authentication_test.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-01-13 16:13:42 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-01-13 16:13:42 +0000
commitc99ef814b0ce5d6b6a677ee6116edac03c8a35b3 (patch)
treed0a9bc3160ba4081bae2bcbc8e412d31a1dd1758 /actionpack/test/controller/http_digest_authentication_test.rb
parent5339f813be99012aba01586743d8b24f065e7034 (diff)
downloadrails-c99ef814b0ce5d6b6a677ee6116edac03c8a35b3.tar.gz
rails-c99ef814b0ce5d6b6a677ee6116edac03c8a35b3.tar.bz2
rails-c99ef814b0ce5d6b6a677ee6116edac03c8a35b3.zip
Revert "HTTP Digest authentication [#1230 state:resolved]"
This reverts commit 45dee3842d68359a189fe7c0729359bd5a905ea4. Reasons : 1. The code is not working in it's current state 2. Should not be using exceptions for flow control
Diffstat (limited to 'actionpack/test/controller/http_digest_authentication_test.rb')
-rw-r--r--actionpack/test/controller/http_digest_authentication_test.rb73
1 files changed, 0 insertions, 73 deletions
diff --git a/actionpack/test/controller/http_digest_authentication_test.rb b/actionpack/test/controller/http_digest_authentication_test.rb
deleted file mode 100644
index d5c8636a9e..0000000000
--- a/actionpack/test/controller/http_digest_authentication_test.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-require 'abstract_unit'
-
-class HttpDigestAuthenticationTest < Test::Unit::TestCase
- include ActionController::HttpAuthentication::Digest
-
- class DummyController
- attr_accessor :headers, :renders, :request, :response
-
- def initialize
- @headers, @renders = {}, []
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- request.session.session_id = "test_session"
- end
-
- def render(options)
- self.renderers << options
- end
- end
-
- def setup
- @controller = DummyController.new
- @credentials = {
- :username => "dhh",
- :realm => "testrealm@host.com",
- :nonce => ActionController::HttpAuthentication::Digest.nonce(@controller.request),
- :qop => "auth",
- :nc => "00000001",
- :cnonce => "0a4f113b",
- :opaque => ActionController::HttpAuthentication::Digest.opaque(@controller.request),
- :uri => "http://test.host/"
- }
- @encoded_credentials = ActionController::HttpAuthentication::Digest.encode_credentials("GET", @credentials, "secret")
- end
-
- def test_decode_credentials
- set_headers
- assert_equal @credentials, decode_credentials(@controller.request)
- end
-
- def test_nonce_format
- assert_nothing_thrown do
- validate_nonce(@controller.request, nonce(@controller.request))
- end
- end
-
- def test_authenticate_should_raise_for_nil_password
- set_headers ActionController::HttpAuthentication::Digest.encode_credentials(:get, @credentials, nil)
- assert_raise ActionController::HttpAuthentication::Error do
- authenticate(@controller, @credentials[:realm]) { |user| user == "dhh" && "secret" }
- end
- end
-
- def test_authenticate_should_raise_for_incorrect_password
- set_headers
- assert_raise ActionController::HttpAuthentication::Error do
- authenticate(@controller, @credentials[:realm]) { |user| user == "dhh" && "bad password" }
- end
- end
-
- def test_authenticate_should_not_raise_for_correct_password
- set_headers
- assert_nothing_thrown do
- authenticate(@controller, @credentials[:realm]) { |user| user == "dhh" && "secret" }
- end
- end
-
- private
- def set_headers(value = @encoded_credentials, name = 'HTTP_AUTHORIZATION', method = "GET")
- @controller.request.env[name] = value
- @controller.request.env["REQUEST_METHOD"] = method
- end
-end