PK~5httpauth/__init__.pyPK„~5EHÌ™g g httpauth/filter.pyfrom trac.core import * from trac.config import ListOption from trac.web.api import IRequestFilter, RequestDone, IAuthenticator from trac.web.chrome import INavigationContributor import base64 from acct_mgr.api import AccountManager __all__ = ['HTTPAuthFilter'] class HTTPAuthFilter(Component): """Request filter and handler to provide HTTP authentication.""" paths = ListOption('httpauth', 'paths', default='/xmlrpc', doc='Paths to force HTTP authentication on.') implements(IRequestFilter, IAuthenticator) # IRequestFilter methods def pre_process_request(self, req, handler): for path in self.paths: if req.path_info.startswith(path): header = req.get_header('Authorization') if header is None: self.log.info('HTTPAuthFilter: No authentication data given, returing 403') return self # Run HTTP auth else: token = header.split()[1] user, passwd = base64.b64decode(token).split(':', 1) if AccountManager(self.env).check_password(user, passwd): self.log.debug('HTTPAuthFilter: Authentication okay') req.__user = user else: self.log.info('HTTPAuthFilter: Bad authentication data given, returing 403') return self # Failed auth return handler def post_process_request(self, req, template, content_type): return template, content_type # IRequestHandler methods def process_request(self, req): if req.session: req.session.save() # Just in case req.send_response(401) req.send_header('WWW-Authenticate', 'Basic realm="Control Panel"') req.send_header('Content-Type', 'text/plain') req.send_header('Pragma', 'no-cache') req.send_header('Cache-control', 'no-cache') req.send_header('Expires', 'Fri, 01 Jan 1999 00:00:00 GMT') req.end_headers() if req.method != 'HEAD': req.write('Authentication required') raise RequestDone # IAuthenticator methods def authenticate(self, req): try: return req.__user except AttributeError: return None # Bail out PK~5Œîbhttpauth/__init__.pyc;ò ˆenEc@sdS(N((((s/build/bdist.linux-i686/egg/httpauth/__init__.pys?sPK~5£Ÿ¯Ç¹ ¹ httpauth/filter.pyc;ò ˆqnEc@ssdkTdklZdklZlZlZdklZdk Z dk l Z dgZ de fd„ƒYZdS((s*(s ListOption(sIRequestFilters RequestDonesIAuthenticator(sINavigationContributorN(sAccountManagersHTTPAuthFiltercBsZtZdZeddddddƒZeeeƒd„Zd„Z d „Z d „Z RS( s:Request filter and handler to provide HTTP authentication.shttpauthspathssdefaults/xmlrpcsdocs&Paths to force HTTP authentication on.cCsåxÚ|iD]Ï}|ii|ƒo¶|idƒ}|tjo|i i dƒ|SqÙ|i ƒd}t i|ƒi ddƒ\}}t|iƒi||ƒo|i idƒ||_qÙ|i i dƒ|Sq q W|SdS(Ns Authorizations:HTTPAuthFilter: No authentication data given, returing 403is:s#HTTPAuthFilter: Authentication okays;HTTPAuthFilter: Bad authentication data given, returing 403(sselfspathsspathsreqs path_infos startswiths get_headersheadersNoneslogsinfossplitstokensbase64s b64decodesuserspasswdsAccountManagersenvscheck_passwordsdebugs_HTTPAuthFilter__usershandler(sselfsreqshandlerspasswdsheaderstokensuserspath((s-build/bdist.linux-i686/egg/httpauth/filter.pyspre_process_requests  !  cCs||fSdS(N(stemplates content_type(sselfsreqstemplates content_type((s-build/bdist.linux-i686/egg/httpauth/filter.pyspost_process_request(scCs­|io|iiƒn|idƒ|iddƒ|iddƒ|iddƒ|iddƒ|id d ƒ|iƒ|id jo|id ƒnt‚dS( Ni‘sWWW-AuthenticatesBasic realm="Control Panel"s Content-Types text/plainsPragmasno-caches Cache-controlsExpiressFri, 01 Jan 1999 00:00:00 GMTsHEADsAuthentication required( sreqssessionssaves send_responses send_headers end_headerssmethodswrites RequestDone(sselfsreq((s-build/bdist.linux-i686/egg/httpauth/filter.pysprocess_request,s   cCs)y |iSWntj o tSnXdS(N(sreqs_HTTPAuthFilter__usersAttributeErrorsNone(sselfsreq((s-build/bdist.linux-i686/egg/httpauth/filter.pys authenticate=s ( s__name__s __module__s__doc__s ListOptionspathss implementssIRequestFiltersIAuthenticatorspre_process_requestspost_process_requestsprocess_requests authenticate(((s-build/bdist.linux-i686/egg/httpauth/filter.pysHTTPAuthFilter s      (s trac.cores trac.configs ListOptions trac.web.apisIRequestFilters RequestDonesIAuthenticatorstrac.web.chromesINavigationContributorsbase64s acct_mgr.apisAccountManagers__all__s ComponentsHTTPAuthFilter( sIAuthenticators ListOptions RequestDones__all__sbase64sIRequestFiltersINavigationContributorsHTTPAuthFiltersAccountManager((s-build/bdist.linux-i686/egg/httpauth/filter.pys?s     PK~5–{z`ppEGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: TracHTTPAuth Version: 1.0 Summary: Use the AccountManager plugin to provide HTTP authentication from Trac itself. Home-page: http://trac-hacks.org/wiki/HttpAuthPlugin Author: Noah Kantrowitz Author-email: coderanger@yahoo.com License: BSD Description: UNKNOWN Keywords: trac plugin http auth Platform: UNKNOWN Classifier: Framework :: Trac PK~5 UÖs  EGG-INFO/SOURCES.txtsetup.py TracHTTPAuth.egg-info/PKG-INFO TracHTTPAuth.egg-info/SOURCES.txt TracHTTPAuth.egg-info/dependency_links.txt TracHTTPAuth.egg-info/entry_points.txt TracHTTPAuth.egg-info/requires.txt TracHTTPAuth.egg-info/top_level.txt httpauth/__init__.py httpauth/filter.py PK~5“×2EGG-INFO/dependency_links.txt PK~5”Ð22EGG-INFO/entry_points.txt[trac.plugins] httpauth.filter = httpauth.filter PK~5Ám>{EGG-INFO/requires.txtTracAccountManagerPK~5ï—Ü EGG-INFO/top_level.txthttpauth PK~5“×2EGG-INFO/zip-safe PK~5¤httpauth/__init__.pyPK„~5EHÌ™g g ¤2httpauth/filter.pyPK~5Œîb¤É httpauth/__init__.pycPK~5£Ÿ¯Ç¹ ¹ ¤{ httpauth/filter.pycPK~5–{z`pp¤eEGG-INFO/PKG-INFOPK~5 UÖs  ¤EGG-INFO/SOURCES.txtPK~5“×2¤AEGG-INFO/dependency_links.txtPK~5”Ð22¤}EGG-INFO/entry_points.txtPK~5Ám>{¤æEGG-INFO/requires.txtPK~5ï—Ü ¤+EGG-INFO/top_level.txtPK~5“×2¤hEGG-INFO/zip-safePK ߘ