aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/http_authentication.rb
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-03-10 13:28:52 -0800
committerwycats <wycats@gmail.com>2010-03-10 13:28:52 -0800
commit4745b53bcda400cf2e8cb4f2c0bf068f6d13c0e5 (patch)
tree6f080f704435d22dbfee6ffd454529c12e5bb505 /actionpack/lib/action_controller/metal/http_authentication.rb
parent7b622786fcc5046a06989ec7a3cbf46f92e04dea (diff)
parent84f6da45a19d335be320991cab44f492f61dc5c7 (diff)
downloadrails-4745b53bcda400cf2e8cb4f2c0bf068f6d13c0e5.tar.gz
rails-4745b53bcda400cf2e8cb4f2c0bf068f6d13c0e5.tar.bz2
rails-4745b53bcda400cf2e8cb4f2c0bf068f6d13c0e5.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'actionpack/lib/action_controller/metal/http_authentication.rb')
-rw-r--r--actionpack/lib/action_controller/metal/http_authentication.rb22
1 files changed, 4 insertions, 18 deletions
diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb
index f1355a83a3..6ec788f302 100644
--- a/actionpack/lib/action_controller/metal/http_authentication.rb
+++ b/actionpack/lib/action_controller/metal/http_authentication.rb
@@ -124,7 +124,7 @@ module ActionController
end
def authenticate(request, &login_procedure)
- unless authorization(request).blank?
+ unless request.authorization.blank?
login_procedure.call(*user_name_and_password(request))
end
end
@@ -133,15 +133,8 @@ module ActionController
decode_credentials(request).split(/:/, 2)
end
- def authorization(request)
- request.env['HTTP_AUTHORIZATION'] ||
- request.env['X-HTTP_AUTHORIZATION'] ||
- request.env['X_HTTP_AUTHORIZATION'] ||
- request.env['REDIRECT_X_HTTP_AUTHORIZATION']
- end
-
def decode_credentials(request)
- ActiveSupport::Base64.decode64(authorization(request).split(' ', 2).last || '')
+ ActiveSupport::Base64.decode64(request.authorization.split(' ', 2).last || '')
end
def encode_credentials(user_name, password)
@@ -176,14 +169,7 @@ module ActionController
# Returns false on a valid response, true otherwise
def authenticate(secret_key, request, realm, &password_procedure)
- authorization(request) && validate_digest_response(secret_key, request, realm, &password_procedure)
- end
-
- def authorization(request)
- request.env['HTTP_AUTHORIZATION'] ||
- request.env['X-HTTP_AUTHORIZATION'] ||
- request.env['X_HTTP_AUTHORIZATION'] ||
- request.env['REDIRECT_X_HTTP_AUTHORIZATION']
+ request.authorization && validate_digest_response(secret_key, request, realm, &password_procedure)
end
# Returns false unless the request credentials response value matches the expected value.
@@ -226,7 +212,7 @@ module ActionController
end
def decode_credentials_header(request)
- decode_credentials(authorization(request))
+ decode_credentials(request.authorization)
end
def decode_credentials(header)