mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
First stab at external authentication support
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
from urllib import parse
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.middleware import RemoteUserMiddleware as RemoteUserMiddleware_
|
||||
from django.db import ProgrammingError
|
||||
from django.http import Http404, HttpResponseRedirect
|
||||
from django.urls import reverse
|
||||
@ -30,6 +31,14 @@ class LoginRequiredMiddleware(object):
|
||||
return self.get_response(request)
|
||||
|
||||
|
||||
class RemoteUserMiddleware(RemoteUserMiddleware_):
|
||||
"""
|
||||
Custom implementation of Django's RemoteUserMiddleware which allows for a user-configurable HTTP header name.
|
||||
"""
|
||||
force_logout_if_no_header = False
|
||||
header = settings.REMOTE_AUTH_HEADER
|
||||
|
||||
|
||||
class APIVersionMiddleware(object):
|
||||
"""
|
||||
If the request is for an API endpoint, include the API version as a response header.
|
||||
|
Reference in New Issue
Block a user