title: Apache, mod_auth_kerb, mod_proxy: Get authenticated user in Go Web Application
body: <p>I'm using Apache as reverse proxy for things like authentication in front of the go http server.</p>
  
  <p>The following apache kerberos setup works with one problem. I don't know how to get the authenticated username in my go application.</p>
  
  <p>httpd.conf:</p>
  
  <pre><code>&lt;VirtualHost host.domain.com:80&gt;
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:9000/
    ProxyPassReverse / http://127.0.0.1:9000/
  
    &lt;Location /&gt;
      ## gzip
      ##
      AddOutputFilterByType DEFLATE text/html
  
      Order                      deny,allow
      Allow                      from all
  
      AuthType                   Kerberos
      AuthName                   "User Admin"
      KrbAuthRealms              DOMAIN.COM
      Krb5Keytab                 /etc/host.krb5keytab
      KrbMethodNegotiate         on
      KrbAuthoritative           on
      KrbMethodK5Passwd          off
      KrbLocalUserMapping on
      KrbSaveCredentials         on
      require valid-user
    &lt;/Location&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>With</p>
  
  <pre><code> AuthType                    basic
  </code></pre>
  
  <p>I get the username from the request's Authorization header with the go function </p>
  
  <pre><code>func (*Request) BasicAuth
  </code></pre>
  
  <p>but with Authorization header negotiate this is not possible. Furthermore I'm not able to use the REMOTE_USER environment variable because there is no cgi environment. I also tried to set the RequestHeader but without any success.</p>
  
  <p>Is there any possibility to get the authorized username from the go application?</p>