diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2011-03-28 18:09:50 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-03-28 18:10:08 -0700 |
commit | e2b07ee000439d0bd41f725ff9f7ad53e52a7e9b (patch) | |
tree | 0f49fd2489ad5e019d5bde163daefa0fe8babb6f /actionpack/CHANGELOG | |
parent | aea1477362b640ebe52cf991b915ad32e7bf2571 (diff) | |
download | rails-e2b07ee000439d0bd41f725ff9f7ad53e52a7e9b.tar.gz rails-e2b07ee000439d0bd41f725ff9f7ad53e52a7e9b.tar.bz2 rails-e2b07ee000439d0bd41f725ff9f7ad53e52a7e9b.zip |
Added Base.http_basic_authenticate_with to do simple http basic authentication with a single class method call [DHH]
Diffstat (limited to 'actionpack/CHANGELOG')
-rw-r--r-- | actionpack/CHANGELOG | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index a90a7b37f7..7f1e7d1c1d 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,42 @@ *Rails 3.1.0 (unreleased)* +* Added Base.http_basic_authenticate_with to do simple http basic authentication with a single class method call [DHH] + + class PostsController < ApplicationController + USER_NAME, PASSWORD = "dhh", "secret" + + before_filter :authenticate, :except => [ :index ] + + def index + render :text => "Everyone can see me!" + end + + def edit + render :text => "I'm only accessible if you know the password" + end + + private + def authenticate + authenticate_or_request_with_http_basic do |user_name, password| + user_name == USER_NAME && password == PASSWORD + end + end + end + + ..can now be written as + + class PostsController < ApplicationController + http_basic_authenticate_with :name => "dhh", "secret", :except => :index + + def index + render :text => "Everyone can see me!" + end + + def edit + render :text => "I'm only accessible if you know the password" + end + end + * Allow you to add `force_ssl` into controller to force browser to transfer data via HTTPS protocol on that particular controller. You can also specify `:only` or `:except` to specific it to particular action. [DHH and Prem Sichanugrist] * Allow FormHelper#form_for to specify the :method as a direct option instead of through the :html hash [DHH] |