aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/action_controller_overview.textile
diff options
context:
space:
mode:
authorSebastian Martinez <sebastian@wyeworks.com>2011-03-28 22:46:13 -0300
committerSebastian Martinez <sebastian@wyeworks.com>2011-03-28 22:46:13 -0300
commit70779a08a0bec1b890c1b7d77114dedc7f1b69e2 (patch)
tree65be8c184348b445b8b6977258d0d4227e5b3da1 /railties/guides/source/action_controller_overview.textile
parent62dd3458e326b1f2927d43401e7b10004410fdf0 (diff)
downloadrails-70779a08a0bec1b890c1b7d77114dedc7f1b69e2.tar.gz
rails-70779a08a0bec1b890c1b7d77114dedc7f1b69e2.tar.bz2
rails-70779a08a0bec1b890c1b7d77114dedc7f1b69e2.zip
Updated Basic Authentication guides to reflect new Base.http_basic_authenticate_with method
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..9dffdce8de 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", "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