# HG changeset patch # User Marcin Kuzminski # Date 1349803590 -7200 # Node ID 976e2b032650ad0215b61460fe8aa58f78ae81a8 # Parent b14850a72bc286c5746f0f2241dbecb19bbade8b patched basic auth function to overcome git issues with proxy that doesn't send both username and password. ref #586 diff -r b14850a72bc2 -r 976e2b032650 rhodecode/lib/base.py --- a/rhodecode/lib/base.py Tue Oct 09 01:32:07 2012 +0200 +++ b/rhodecode/lib/base.py Tue Oct 09 19:26:30 2012 +0200 @@ -8,8 +8,7 @@ from paste.auth.basic import AuthBasicAuthenticator from paste.httpexceptions import HTTPUnauthorized, HTTPForbidden -from webob.exc import HTTPClientError -from paste.httpheaders import WWW_AUTHENTICATE +from paste.httpheaders import WWW_AUTHENTICATE, AUTHORIZATION from pylons import config, tmpl_context as c, request, session, url from pylons.controllers import WSGIController @@ -74,6 +73,23 @@ return HTTPForbidden(headers=head) return HTTPUnauthorized(headers=head) + def authenticate(self, environ): + authorization = AUTHORIZATION(environ) + if not authorization: + return self.build_authentication() + (authmeth, auth) = authorization.split(' ', 1) + if 'basic' != authmeth.lower(): + return self.build_authentication() + auth = auth.strip().decode('base64') + _parts = auth.split(':', 1) + if len(_parts) == 2: + username, password = _parts + if self.authfunc(environ, username, password): + return username + return self.build_authentication() + + __call__ = authenticate + class BaseVCSController(object):