Skip to content

Instantly share code, notes, and snippets.

@daddz
Created Mar 18, 2011
Embed
What would you like to do?
require './rack_auth_digest'
run Protected.app
require 'sinatra/base'
class Protected < Sinatra::Base
get '/' do
"Hello from protected"
end
def self.app
app = Rack::Auth::Digest::MD5.new(Protected.new) do |username|
{'foo' => 'bar'}[username]
end
app.realm = 'Protected Area'
app.opaque = 'asotjrskw42ptr23")$kamnd'
app
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment