Created
March 21, 2012 19:35
-
-
Save davidcornu/2151803 to your computer and use it in GitHub Desktop.
http basic auth with rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
class StaticController < ApplicationController | |
before_filter :admin_authentication, :only => :api_test | |
def index | |
end | |
def getting_started | |
end | |
def hardware | |
end | |
def pricing | |
end | |
def product_tour | |
end | |
def contact | |
end | |
def api_test | |
render :layout => false | |
end | |
private | |
def admin_authentication | |
authenticate_or_request_with_http_basic do |username, password| | |
credentials = Ambrosia::Application.config.admin_credentials | |
username == credentials['username'] && password == credentials['password'] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment