<p>I've got the directive</p>

<pre><code>&lt;VirtualHost *&gt;
    &lt;Location /&gt;
        AuthType Digest
        AuthName "global"
        AuthDigestDomain /
        AuthUserFile /root/apache_users
        &lt;Limit GET&gt;
            Require valid-user
        &lt;/Limit&gt;
    &lt;/Location&gt;
    WSGIScriptAlias / /some/script.wsgi
    WSGIDaemonProcess mywsgi user=someuser group=somegroup processes=2 threads=25
    WSGIProcessGroup mywsgi
    ServerName some.example.org
&lt;/VirtualHost&gt;
</code></pre>

<p>I'd like to know in the /some/script.wsgi</p>

<pre><code>def application(environ, start_response):
    start_response('200 OK', [
        ('Content-Type', 'text/plain'),
    ])
    return ['Hello']
</code></pre>

<p>What user is logged in.</p>

<p>How do I do that?</p>

add
```
WSGIPassAuthorization On
```
:
```
```
<VirtualHost *>
    <Location />
        AuthType Digest
        AuthName "global"
        AuthDigestDomain /
        AuthUserFile /root/apache_users
        <Limit GET>
            Require valid-user
        </Limit>
    </Location>
    WSGIPassAuthorization On
    WSGIScriptAlias / /some/script.wsgi
    WSGIDaemonProcess mywsgi user=someuser group=somegroup processes=2 threads=25
    WSGIProcessGroup mywsgi
    ServerName some.example.org
</VirtualHost>
```
```
Then just read
```
environ['REMOTE_USER']
```
:
```
```
def application(environ, start_response):
    start_response('200 OK', [
        ('Content-Type', 'text/plain'),
    ])
    return ['Hello %s' % environ['REMOTE_USER']]
```
```
More information at
mod_wsgi documentation
.