tamacyaのブック
mindiatamacyaのブック見出し語

rails BASIC認証

tamasally · 2012-04-28 更新

authenticate_or_request_with_http_basicを使う。
すごく簡単だった。

app/controllers/application_controller.rb

class ApplicationController < ActionController::Base
before_filter :authenticate

private
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == 'ユーザー名' && password == 'パスワード'
end
end
end

関連する見出し語