title: Get password inside authenticate_or_request_with_http_digest
body: <p>I have an app which connects to an iphone app, which in turn authenticates it's users via http_digest.</p>
  
  <p>I'm using authlogic, and in my schema users of the website are "users" and users of the phone app are "people".  So, i have user_sessions and people_sessions.  To handle the http_digest auth, i'm using the authenticate_or_request_with_http_digest method like this:</p>
  
  <pre><code>def digest_authenticate_person
    authenticate_or_request_with_http_digest do |email, password|
      #ldb is just a logging method i have
      ldb "email = #{email.inspect}, password = #{password.inspect}"
      person = Person.find_by_email(email)
      if person
        ldb "Authentication successful: Got person with id #{person.id}"
        @current_person_session = PersonSession.create(person)        
      else
        ldb "Authentication failed"
        @current_person_session = nil
      end
      return @current_person_session
    end
  end
  </code></pre>
  
  <p>I can see in the logs that password is nil: only email is passed through to the inside of the authenticate_or_request_with_http_digest block.  </p>
  
  <p>Im testing this with a curl call like so:</p>
  
  <pre><code>curl --digest --user fakename@madeup.xyz:apass "http://localhost:3000/reports.xml"
  </code></pre>
  
  <p>I'd expect "fakename@madeup.xyz" and "apass" to get passed through to the inside of the block.  Once i have the password then i can use a combination of email and password to find (or not) a user, in the normal way.  Does anyone know how i can get access to the password as well?  </p>
  
  <p>grateful for any advice - max</p>
  
  <p>EDIT - on further googling, i think i'm using this method wrong: i'm supposed to just return the password, or the crypted password.  But then how do i compare that against the password passed as part of the http_digest username?</p>