Permalink
Browse files

Modify Digest and Basic to take a request so they can be used outside…

… of the controller
  • Loading branch information...
1 parent 86c7b14 commit 469424c85e877c4c6f822c31e8462ff1778550eb Yehuda Katz + Carl Lerche committed Aug 25, 2009
Showing with 7 additions and 7 deletions.
  1. +7 −7 actionpack/lib/action_controller/metal/http_authentication.rb
@@ -115,17 +115,17 @@ def authenticate_or_request_with_http_basic(realm = "Application", &login_proced
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")
HttpAuthentication::Basic.authentication_request(self, realm)
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 @@ def authenticate_or_request_with_http_digest(realm = "Application", &password_pr
# 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 @@ def request_http_digest_authentication(realm = "Application", message = nil)
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)

0 comments on commit 469424c

Please sign in to comment.