346 req, path = path, req |
346 req, path = path, req |
347 if req.authmode == 'http': |
347 if req.authmode == 'http': |
348 # activate realm-based auth |
348 # activate realm-based auth |
349 realm = self.vreg.config['realm'] |
349 realm = self.vreg.config['realm'] |
350 req.set_header('WWW-Authenticate', [('Basic', {'realm' : realm })], raw=False) |
350 req.set_header('WWW-Authenticate', [('Basic', {'realm' : realm })], raw=False) |
|
351 content = '' |
351 try: |
352 try: |
352 self.connect(req) |
353 self.connect(req) |
353 # DENY https acces for anonymous_user |
354 # DENY https acces for anonymous_user |
354 if (req.https |
355 if (req.https |
355 and req.session.anonymous_session |
356 and req.session.anonymous_session |
356 and self.vreg.config['https-deny-anonymous']): |
357 and self.vreg.config['https-deny-anonymous']): |
357 # don't allow anonymous on https connection |
358 # don't allow anonymous on https connection |
358 raise AuthenticationError() |
359 raise AuthenticationError() |
359 content = '' |
|
360 # nested try to allow LogOut to delegate logic to AuthenticationError |
360 # nested try to allow LogOut to delegate logic to AuthenticationError |
361 # handler |
361 # handler |
362 try: |
362 try: |
363 ### Try to generate the actual request content |
363 ### Try to generate the actual request content |
364 content = self.core_handle(req, path) |
364 content = self.core_handle(req, path) |