title: Is there a way to get a password from HTTP authorization header in Apache2 config?
body: <p>I've found that I can access HTTP Authorization header by the following code</p>
  
  <pre><code>RewriteEngine on
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
  </code></pre>
  
  <p>Unfortunately I don't understand how to decode it from base64 and then split username and password.</p>
  
  <p>Of course it's very easy to do this outside apache config, but I need user name and password inside the config in order to pass them to LDAP authorization module.</p>
  
  <p>Actually I want to do something like this:</p>
  
  <pre><code>&lt;Directory "C:/my/directory"&gt;
      WSGIApplicationGroup %{GLOBAL}
      Order deny,allow
      Allow from all
  
      AuthType Basic
      AuthName "Trac"
      AuthBasicProvider "ldap"
      AuthLDAPURL "ldap://domain.local:3268/DC=domain,DC=local?sAMAccountName?sub?&gt; (objectClass=user)"
      AuthLDAPBindDN       %{HTTP_USER}@domain.local
      AuthLDAPBindPassword %{HTTP_PASSWORD}
  
      AuthzLDAPAuthoritative off
  
      Require valid-user
  &lt;/Directory&gt;
  </code></pre>
  
  <p>I need this because our LDAP server doesn't accept anonymous requests.</p>