Beispiel #1
0
    def wrapper(request, *args, **kwargs):
        try:
            token = request.COOKIES['access_token']
            user = Client.authenticate_access_token(token)
            check_if_user_has_role(user, roles)

            return func(request, *args, **kwargs)
        except Exception as e:
            response = {'response': 'Exception ' + e.__str__()}
            return render(request, 'website/login.html', status=403)
Beispiel #2
0
def get_client(request):
    access_token = request.COOKIES.get('access_token')
    client = Client.authenticate_access_token(access_token)
    return client