firstruby

Master ruby with us

Posts Tagged ‘authentication’

HTTP authentication for Ruby on Rails application

Posted by firstruby on June 23, 2011

You may want to add HTTP authentication to your Ruby on Rails site, add following to your application controller file,


before_filter :authenticate

protected

def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == "test" && password == "test"
end
end

After adding these lines, application will ask for username and password.

Posted in Useful Links | Tagged: , , , | Leave a Comment »