Show More
@@ -8,8 +8,7 b' import traceback' | |||
|
8 | 8 | |
|
9 | 9 | from paste.auth.basic import AuthBasicAuthenticator |
|
10 | 10 | from paste.httpexceptions import HTTPUnauthorized, HTTPForbidden |
|
11 | from webob.exc import HTTPClientError | |
|
12 | from paste.httpheaders import WWW_AUTHENTICATE | |
|
11 | from paste.httpheaders import WWW_AUTHENTICATE, AUTHORIZATION | |
|
13 | 12 | |
|
14 | 13 | from pylons import config, tmpl_context as c, request, session, url |
|
15 | 14 | from pylons.controllers import WSGIController |
@@ -74,6 +73,23 b' class BasicAuth(AuthBasicAuthenticator):' | |||
|
74 | 73 | return HTTPForbidden(headers=head) |
|
75 | 74 | return HTTPUnauthorized(headers=head) |
|
76 | 75 | |
|
76 | def authenticate(self, environ): | |
|
77 | authorization = AUTHORIZATION(environ) | |
|
78 | if not authorization: | |
|
79 | return self.build_authentication() | |
|
80 | (authmeth, auth) = authorization.split(' ', 1) | |
|
81 | if 'basic' != authmeth.lower(): | |
|
82 | return self.build_authentication() | |
|
83 | auth = auth.strip().decode('base64') | |
|
84 | _parts = auth.split(':', 1) | |
|
85 | if len(_parts) == 2: | |
|
86 | username, password = _parts | |
|
87 | if self.authfunc(environ, username, password): | |
|
88 | return username | |
|
89 | return self.build_authentication() | |
|
90 | ||
|
91 | __call__ = authenticate | |
|
92 | ||
|
77 | 93 | |
|
78 | 94 | class BaseVCSController(object): |
|
79 | 95 |
General Comments 0
You need to be logged in to leave comments.
Login now