From 469424c85e877c4c6f822c31e8462ff1778550eb Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Tue, 25 Aug 2009 15:05:23 -0700 Subject: Modify Digest and Basic to take a request so they can be used outside of the controller --- .../lib/action_controller/metal/http_authentication.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb index 2b62a1be85..e33882cc1b 100644 --- a/actionpack/lib/action_controller/metal/http_authentication.rb +++ b/actionpack/lib/action_controller/metal/http_authentication.rb @@ -115,7 +115,7 @@ module ActionController end def authenticate_with_http_basic(&login_procedure) - HttpAuthentication::Basic.authenticate(self, &login_procedure) + HttpAuthentication::Basic.authenticate(request, &login_procedure) end def request_http_basic_authentication(realm = "Application") @@ -123,9 +123,9 @@ module ActionController end end - def authenticate(controller, &login_procedure) - unless authorization(controller.request).blank? - login_procedure.call(*user_name_and_password(controller.request)) + def authenticate(request, &login_procedure) + unless authorization(request).blank? + login_procedure.call(*user_name_and_password(request)) end end @@ -164,7 +164,7 @@ module ActionController # Authenticate with HTTP Digest, returns true or false def authenticate_with_http_digest(realm = "Application", &password_procedure) - HttpAuthentication::Digest.authenticate(self, realm, &password_procedure) + HttpAuthentication::Digest.authenticate(request, realm, &password_procedure) end # Render output including the HTTP Digest authentication header @@ -174,8 +174,8 @@ module ActionController end # Returns false on a valid response, true otherwise - def authenticate(controller, realm, &password_procedure) - authorization(controller.request) && validate_digest_response(controller.request, realm, &password_procedure) + def authenticate(request, realm, &password_procedure) + authorization(request) && validate_digest_response(request, realm, &password_procedure) end def authorization(request) -- cgit v1.2.3