Skip to content

Instantly share code, notes, and snippets.

@daddz
Created March 18, 2011 13:31
Show Gist options
  • Save daddz/876065 to your computer and use it in GitHub Desktop.
Save daddz/876065 to your computer and use it in GitHub Desktop.
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