Skip to content

Instantly share code, notes, and snippets.

@felipecabargas
Created February 6, 2014 20:33
Show Gist options
  • Save felipecabargas/8851972 to your computer and use it in GitHub Desktop.
Save felipecabargas/8851972 to your computer and use it in GitHub Desktop.
Simple HTTP Basic Auth snippet for RailsControllers
before_filter :authenticate
protected
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == "foo" && password == "bar"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment