kpsul/kfet/middleware.py
Aurélien Delobelle 9aa0e8b89d Message
2016-09-02 14:50:09 +02:00

17 lines
579 B
Python

# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.http import HttpResponseForbidden
from kfet.backends import KFetBackend
from kfet.models import Account
class KFetAuthenticationMiddleware(object):
def process_request(self, request):
kfet_backend = KFetBackend()
temp_request_user = kfet_backend.authenticate(request)
if temp_request_user:
request.real_user = request.user
request.user = temp_request_user