title: Rails metal http basic auth
body: <p>I am trying to use HTTP basic authentication when a remote service hits one of my Rails metal endpoints. </p>
  
  <p>I am wondering how to get access to the username and password of the request. So far, I have printed out the entire env object and can't find the username or password anywhere in that object.</p>
  
  <p>Instead, I see
  "HTTP_AUTHORIZATION"=>"Basic YW5yZ3JpZDpzYWZlbWFpbA==", "PASSENGER_CONNECT_PASSWORD"=>"U4vAn6lVAOe2C8nIQSWT93j3SFJkA5VxOicSeDspF9a"</p>
  
  <p>But I am not sure what to do with this.</p>
  
  <p>Ideally, I'd like to do something like:</p>
  
  <pre><code>class MyHook
    def self.call(env)
      user = env[...]
      pass = env[...]
      if (user == "foo" &amp;&amp; pass == "pass")
        # do stuff
      end
    end
  end
  </code></pre>
  
  <p>Thanks!</p>