Skip to content

Instantly share code, notes, and snippets.

@nixterrimus
Created September 22, 2011 07:46
Show Gist options
  • Save nixterrimus/1234258 to your computer and use it in GitHub Desktop.
Save nixterrimus/1234258 to your computer and use it in GitHub Desktop.
HTTP Basic Authentication
class PagesController < ApplicationController
before_filter :authenticate
def secret_page
@time = Time.now
end
protected
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == "admin" && password == "password"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment