RailsCasts - Ruby on Rails Screencasts

RailsCasts Pro episodes are now free!

Learn more or hide this

HTTP Basic Authentication

#82 HTTP Basic Authentication

Dec 02, 2007 | 4 minutes | Controllers, Administration, Rails 2.0, Authentication
Rails 2.0 offers an extremely easy way to do HTTP basic authentication. See how in this episode.
Click to Play Video ▶
Tweet
  • Download:
  • mp4 Full Size H.264 Video (7.95 MB)
  • m4v Smaller H.264 Video (4.88 MB)
  • webm Full Size VP8 Video (13.1 MB)
  • ogv Full Size Theora Video (10.1 MB)

Resources

products_controller.rb
before_filter :authenticate
protected
def authenticate
 authenticate_or_request_with_http_basic do |username, password|
 username == "foo" && password == "bar"
 end
end
loading

AltStyle によって変換されたページ (->オリジナル) /