doc:appunti:linux:sa:libapache2-mod-python
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
doc:appunti:linux:sa:libapache2-mod-python [2016/03/03 22:17] – created niccolo | doc:appunti:linux:sa:libapache2-mod-python [2016/03/03 22:22] (current) – [Autenticazione con PythonAuthenHandler] niccolo | ||
---|---|---|---|
Line 4: | Line 4: | ||
< | < | ||
- | | + | < |
- | SetHandler mod_python | + | SetHandler mod_python |
- | PythonPath " | + | PythonPath " |
- | # | + | # |
- | PythonHandler mptest | + | PythonHandler mptest |
- | PythonDebug On | + | PythonDebug On |
- | </ | + | </ |
</ | </ | ||
Line 27: | Line 27: | ||
req.write(" | req.write(" | ||
return apache.OK | return apache.OK | ||
+ | </ | ||
+ | |||
+ | ===== Autenticazione con PythonAuthenHandler ===== | ||
+ | |||
+ | Per delegare l' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | AuthType Basic | ||
+ | AuthName " | ||
+ | AuthUserFile /dev/null | ||
+ | AuthBasicAuthoritative Off | ||
+ | PythonAuthenHandler authpippo | ||
+ | Require valid-user | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | <code python> | ||
+ | from mod_python import apache | ||
+ | |||
+ | def authenhandler(req): | ||
+ | pw = req.get_basic_auth_pw() | ||
+ | user = req.user | ||
+ | if user == " | ||
+ | return apache.OK | ||
+ | else: | ||
+ | return apache.HTTP_UNAUTHORIZED | ||
</ | </ |
doc/appunti/linux/sa/libapache2-mod-python.1457039837.txt.gz · Last modified: 2016/03/03 22:17 by niccolo