diff options
author | Joshua Peek <josh@joshpeek.com> | 2011-03-18 10:19:30 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2011-03-18 10:19:30 -0500 |
commit | b7a08718f71a333ece8e830cc9808ce75e645886 (patch) | |
tree | d3bbf8374cb52c4c0e599cb255e525e3a2d69e4f | |
parent | a1eb9c28f8f7b4b76c0e3cc22be01f891e1b9d50 (diff) | |
parent | 71a07b9d9c90953002452c3ed6ea48ef256fa1c9 (diff) | |
download | rack-b7a08718f71a333ece8e830cc9808ce75e645886.tar.gz |
Merge branch 'auth-digest-with-rack-builder' of https://github.com/rkh/rack into rkh-auth-digest-with-rack-builder
-rw-r--r-- | lib/rack/auth/digest/md5.rb | 8 | ||||
-rw-r--r-- | test/spec_auth_digest.rb | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/rack/auth/digest/md5.rb b/lib/rack/auth/digest/md5.rb index d277571c..36aa8443 100644 --- a/lib/rack/auth/digest/md5.rb +++ b/lib/rack/auth/digest/md5.rb @@ -21,9 +21,13 @@ module Rack attr_writer :passwords_hashed - def initialize(*args) - super + def initialize(app, realm=nil, opaque=nil, &authenticator) @passwords_hashed = nil + if opaque.nil? and realm.respond_to? :values_at + realm, opaque, @passwords_hashed = realm.values_at :realm, :opaque, :passwords_hashed + end + super(app, realm, &authenticator) + @opaque = opaque end def passwords_hashed? diff --git a/test/spec_auth_digest.rb b/test/spec_auth_digest.rb index bb22a0ba..c85d7172 100644 --- a/test/spec_auth_digest.rb +++ b/test/spec_auth_digest.rb @@ -14,12 +14,9 @@ describe Rack::Auth::Digest::MD5 do end def protected_app - app = Rack::Auth::Digest::MD5.new(unprotected_app) do |username| + Rack::Auth::Digest::MD5.new(unprotected_app, :realm => realm, :opaque => 'this-should-be-secret') do |username| { 'Alice' => 'correct-password' }[username] end - app.realm = realm - app.opaque = 'this-should-be-secret' - app end def protected_app_with_hashed_passwords |