Hello all,
Has anyone been able to figure out how to use the digest authentication
provided in Rack? I tried searching the web and tried reading Rack’s
documentation, but still haven’t had any success. The
Rack::Auth::Digest::MD5 class has the following documentation:
Rack::Auth::Digest::MD5 implements the MD5 algorithm version of
HTTP Digest Authentication, as per RFC 2617.
Initialize with the [Rack] application that you want protecting,
and a block that looks up a plaintext password for a given username.
+opaque+ needs to be set to a constant base64/hexadecimal string.
So, I tried the following:
require ‘rubygems’
require ‘sinatra’
get ‘/admin’ do
Rack::Auth::Digest::MD5.new(self) do |u,p|
u == ‘foo’ && p == ‘bar’
end
“Authorized!”
end
However, I was never asked for my credentials…
So, has anyone had the chance to get this working?
–
Thanks!
Bryan