BasicObject
# File spec/lib/test_web_server.rb, line 14 def authorized? @auth ||= Rack::Auth::Basic::Request.new(request.env) @auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == ['admin', 'secret'] end
# File spec/lib/test_web_server.rb, line 7 def protected! unless authorized? response['WWW-Authenticate'] = %Q(Basic realm="BigBench TestWebServer") throw(:halt, [401, "Not authorized\n"]) end end