# Path: shrubbery/authentication/exceptions.py
# class Http403(Exception): pass
# 
# Path: shrubbery/authentication/contexts.py
# def get_authentication_contexts():
#     global _authentication_contexts
#     if _authentication_contexts is None:
#         _authentication_contexts = []
#         for path in settings['shrubbery.authentication'].CONTEXTS:
#             module_name, name = path.rsplit('.', 1)
#             module = import_module(module_name)
#             context = getattr(module, name)
#             _authentication_contexts.append(context)
#     return _authentication_contexts


from django.utils.functional import SimpleLazyObject
from django.core.signals import request_started, request_finished
from django.http import HttpResponseForbidden
from shrubbery.authentication.exceptions import Http403
from shrubbery.authentication.contexts import get_authentication_contexts


class AuthenticationMiddleware(object):
    def process_request(self, request):
        for context in get_authentication_contexts():
            context.user = lambda: context.get_user(request)
    
    def process_response(self, request, response):

# Path: shrubbery/authentication/exceptions.py
# class Http403(Exception): pass
# 
# Path: shrubbery/authentication/contexts.py
# def get_authentication_contexts():
#     global _authentication_contexts
#     if _authentication_contexts is None:
#         _authentication_contexts = []
#         for path in settings['shrubbery.authentication'].CONTEXTS:
#             module_name, name = path.rsplit('.', 1)
#             module = import_module(module_name)
#             context = getattr(module, name)
#             _authentication_contexts.append(context)
#     return _authentication_contexts


# Path: shrubbery/authentication/middleware.py
from django.utils.functional import SimpleLazyObject
from django.core.signals import request_started, request_finished
from django.http import HttpResponseForbidden
from shrubbery.authentication.exceptions import Http403
from shrubbery.authentication.contexts import get_authentication_contexts



class AuthenticationMiddleware(object):
    def process_request(self, request):
        for context in get_authentication_contexts():
            context.user = lambda: context.get_user(request)
    
    def process_response(self, request, response):

        for context in get_authentication_contexts():