Created
March 18, 2011 13:31
-
-
Save daddz/876065 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './rack_auth_digest' | |
run Protected.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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