From 1519d94b5f8e4e58f75db325b6a67a975f157759 Mon Sep 17 00:00:00 2001 From: Johan Fleury Date: Fri, 25 Sep 2020 10:18:13 -0400 Subject: [PATCH] feat: add support for REMOTE_AUTH_* options --- configuration/configuration.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/configuration/configuration.py b/configuration/configuration.py index 404b6a0..0c22241 100644 --- a/configuration/configuration.py +++ b/configuration/configuration.py @@ -187,6 +187,18 @@ PAGINATE_COUNT = int(os.environ.get('PAGINATE_COUNT', 50)) # prefer IPv4 instead. PREFER_IPV4 = os.environ.get('PREFER_IPV4', 'False').lower() == 'true' +# Remote authentication support +REMOTE_AUTH_ENABLED = os.environ.get('REMOTE_AUTH_ENABLED', 'False').lower() == 'true' +REMOTE_AUTH_BACKEND = os.environ.get('REMOTE_AUTH_BACKEND', 'netbox.authentication.RemoteUserBackend') +REMOTE_AUTH_HEADER = os.environ.get('REMOTE_AUTH_HEADER', 'HTTP_REMOTE_USER') +REMOTE_AUTH_AUTO_CREATE_USER = os.environ.get('REMOTE_AUTH_AUTO_CREATE_USER', 'True').lower() == 'true' +REMOTE_AUTH_DEFAULT_GROUPS = os.environ.get('REMOTE_AUTH_DEFAULT_GROUPS', '').split(' ') +REMOTE_AUTH_DEFAULT_PERMISSIONS = dict( + permission.split(':') + for permission in os.environ.get('REMOTE_AUTH_DEFAULT_PERMISSIONS', '').split(' ') + if permission +) + # This determines how often the GitHub API is called to check the latest release of NetBox in seconds. Must be at least 1 hour. RELEASE_CHECK_TIMEOUT = os.environ.get('RELEASE_CHECK_TIMEOUT', 24 * 3600)