app-restconsole
app-restconsole copied to clipboard
Support for digest authentication
Hi,
It would be very nice to have digest authentication on the client too. I need to test a few services that uses this kind of authentication.
Thanks
agreed, I've been working on adding that.
Seconded
Guys, I've never used digest auth before, is there a quick and easy way to test a server side implementation of it? can you point me to some service already out there that uses it so I can test against?
thanks.
Sorry, I don't know a service to test. But I wrote a simple example of a digest server in ruby using rack.
- Install ruby and rack (if you don't is easy to find tutorials in web)
- Create a file with the contents below and save as config.ru
- Run rackup at command line
require "rubygems"
require "rack"
class AuthDigest
REALM = "realm"
OPAQUE = "opaque"
USERNAME = "username"
PASSWORD = "password"
def initialize(app)
@app = app
end
def call(env)
secure_app = Rack::Auth::Digest::MD5.new(@app) do |username|
Digest::MD5.hexdigest("#{username}:#{REALM}:#{PASSWORD}") if USERNAME == username
end
secure_app.realm = REALM
secure_app.opaque = OPAQUE
secure_app.passwords_hashed = true
secure_app.call(env)
end
end
App = Rack::Builder.new
use AuthDigest
map "/" do
[200, {"Content-Type" => "text/plain"}, "Authenticated"]
end
end
thank you! this is exactly what I needed.