aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/action_controller_overview.textile
diff options
context:
space:
mode:
authorozzyaaron <aaron@thefrontiergroup.com.au>2011-03-29 11:23:20 +0800
committerozzyaaron <aaron@thefrontiergroup.com.au>2011-03-29 11:23:20 +0800
commit837f0ab5c8595609ec31cf885dbe04f0caa15ce0 (patch)
tree2ed015359e57e7b42ce377626b88e93aa956f1ff /railties/guides/source/action_controller_overview.textile
parentd5dc02b5e88324bdbd274a5008a1d6b7a2f6f9d7 (diff)
parent54af8dfbfc4122494235d817cd98b83874241215 (diff)
downloadrails-837f0ab5c8595609ec31cf885dbe04f0caa15ce0.tar.gz
rails-837f0ab5c8595609ec31cf885dbe04f0caa15ce0.tar.bz2
rails-837f0ab5c8595609ec31cf885dbe04f0caa15ce0.zip
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'railties/guides/source/action_controller_overview.textile')
-rw-r--r--railties/guides/source/action_controller_overview.textile17
1 files changed, 3 insertions, 14 deletions
diff --git a/railties/guides/source/action_controller_overview.textile b/railties/guides/source/action_controller_overview.textile
index 178d98c2d6..496dc7224b 100644
--- a/railties/guides/source/action_controller_overview.textile
+++ b/railties/guides/source/action_controller_overview.textile
@@ -615,26 +615,15 @@ Rails comes with two built-in HTTP authentication mechanisms:
h4. HTTP Basic Authentication
-HTTP basic authentication is an authentication scheme that is supported by the majority of browsers and other HTTP clients. As an example, consider an administration section which will only be available by entering a username and a password into the browser's HTTP basic dialog window. Using the built-in authentication is quite easy and only requires you to use one method, +authenticate_or_request_with_http_basic+.
+HTTP basic authentication is an authentication scheme that is supported by the majority of browsers and other HTTP clients. As an example, consider an administration section which will only be available by entering a username and a password into the browser's HTTP basic dialog window. Using the built-in authentication is quite easy and only requires you to use one method, +http_basic_authenticate_with+.
<ruby>
class AdminController < ApplicationController
- USERNAME, PASSWORD = "humbaba", "5baa61e4"
-
- before_filter :authenticate
-
- private
-
- def authenticate
- authenticate_or_request_with_http_basic do |username, password|
- username == USERNAME &&
- Digest::SHA1.hexdigest(password) == PASSWORD
- end
- end
+ http_basic_authenticate_with :name => "humbaba", :password => "5baa61e4"
end
</ruby>
-With this in place, you can create namespaced controllers that inherit from +AdminController+. The before filter will thus be run for all actions in those controllers, protecting them with HTTP basic authentication.
+With this in place, you can create namespaced controllers that inherit from +AdminController+. The filter will thus be run for all actions in those controllers, protecting them with HTTP basic authentication.
h4. HTTP Digest Authentication