2008-09-23 2 views
7

지시어mod_wsgi가 실행하는 wsgi 스크립트에 apache2 다이제스트 인증 정보 전달

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

알고 싶습니다. /some/script.wsgi

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

어떤 사용자가 로그인 했는가?

어떻게 할 수 있습니까? ?

답변

14

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> 

가 그럼 그냥 environ['REMOTE_USER']을 읽어

def application(environ, start_response): 
    start_response('200 OK', [ 
     ('Content-Type', 'text/plain'), 
    ]) 
    return ['Hello %s' % environ['REMOTE_USER']] 

더 많은 정보를 mod_wsgi documentation에서.

+0

많은 의무가 있습니다. –

2
아파치/mod_wsgi에 액세스, 인증 및 권한 부여 메커니즘에 대한

추가 정보는에서 찾을 수 있습니다 이렇게하면 응용 프로그램에 대한 암호 정보를 누설 수 있기 때문에이 정보는 기본적으로 전달되지 않습니다

http://code.google.com/p/modwsgi/wiki/AccessControlMechanisms

하는 아마 그것을 얻지 말아야한다.

관련 문제