Digest Authentication in Rack

  • Thread starter Bryan Richardson
  • Start date
B

Bryan Richardson

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top