Edited at

HTTP認証

More than 1 year has passed since last update.


HTTP認証


BAISIC認証

http_basic_authenticate_with

class AdminsController < ApplicationController

http_basic_authenticate_with name: "humbaba", password: "5baa61e4"
end


ダイジェスト認証

authenticate_or_request_with_http_digestメソッド

class AdminsController < ApplicationController

USERS = { "lifo" => "world" }

before_action :authenticate

private

def authenticate
authenticate_or_request_with_http_digest do |username|
USERS[username]
end
end
end