# -*- coding: utf-8 -*-
from kfet.backends import KFetBackend
def kfet_auth_middleware(get_response):
kfet_backend = KFetBackend()
def middleware(request):
temp_request_user = kfet_backend.authenticate(request)
if temp_request_user:
request.real_user = request.user
request.user = temp_request_user
return get_response(request)
return middleware