1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Modify Digest and Basic to take a request so they can be used outside of the controller

This commit is contained in:
Yehuda Katz + Carl Lerche 2009-08-25 15:05:23 -07:00
parent 86c7b144fa
commit 469424c85e

View file

@ -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)