diff --git a/.install_deps b/.install_deps index fe86016..b2a8377 100755 --- a/.install_deps +++ b/.install_deps @@ -1,10 +1,10 @@ #!/bin/bash if [[ $DEPS_VERSION = "OLD" ]]; then - pip install Jinja2==2.4 jupyterhub==0.9.0 lxml==4.2.1 signxml==2.6.0 pytz==2019.1 + pip install Jinja2==2.7 jupyterhub==0.9.0 lxml==4.2.1 signxml==2.6.0 pytz==2019.1 pip install pytest==4.0.0 pytest-asyncio==0.10.0 pytest-cov==2.0.0; elif [[ $DEPS_VERSION = "AFTER38" ]]; then - pip install Jinja2==2.4 jupyterhub==0.9.0 lxml==4.3.5 signxml==2.6.0 pytz==2019.1 + pip install Jinja2==2.7 jupyterhub==0.9.0 lxml==4.3.5 signxml==2.6.0 pytz==2019.1 pip install pytest==4.0.0 pytest-asyncio==0.10.0 pytest-cov==2.0.0; else pip install --upgrade --pre -r requirements.txt diff --git a/.travis.yml b/.travis.yml index 3094db0..de2248a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: python -sudo: false +os: linux cache: - pip @@ -18,9 +18,15 @@ script: after_success: - codecov -matrix: +jobs: fast_finish: true include: + - name: "Python 3.9 Oldest Dependencies" + python: "3.9" + env: DEPS_VERSION=AFTER38 + - name: "Python 3.9 Latest Dependencies" + python: "3.9" + env: DEPS_VERSION=NEW - name: "Python 3.8 Oldest Dependencies" python: "3.8" env: DEPS_VERSION=AFTER38 diff --git a/requirements.txt b/requirements.txt index 8b7c8e8..529ea96 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Jinja2>=2.4 +Jinja2>=2.7 jupyterhub>=0.9.0 lxml>=4.2.1 signxml>=2.6.0 diff --git a/samlauthenticator/samlauthenticator.py b/samlauthenticator/samlauthenticator.py index 05b99ed..9d54780 100644 --- a/samlauthenticator/samlauthenticator.py +++ b/samlauthenticator/samlauthenticator.py @@ -622,10 +622,24 @@ def _optional_user_add(self, username): # say something like "if adding the user is successful, return username" return not subprocess.call([self.create_system_user_binary, username]) + # JH did a clumsy job of renaming (white|black)list -> (allowed|blocked)_users, + # so it falls on me to paper over their mistakes. + def _check_blocked_users(self, username): + try: + return self.check_blacklist(username) + except DeprecationWarning: + return self.check_blocked_users(username) + + def _check_allowed_users(self, username): + try: + return self.check_whitelist(username) + except DeprecationWarning: + return self.check_allowed_users(username) + def _check_username_and_add_user(self, username): if self.validate_username(username) and \ - self.check_blacklist(username) and \ - self.check_whitelist(username): + self._check_blocked_users(username) and \ + self._check_allowed_users(username): if self.create_system_users: if self._optional_user_add(username): # Successfully added user diff --git a/tests/test_authenticator.py b/tests/test_authenticator.py index 554e683..e7c2c73 100644 --- a/tests/test_authenticator.py +++ b/tests/test_authenticator.py @@ -619,12 +619,14 @@ def test_check_username_valid_username_no_black_lists(self): a._optional_user_add = MagicMock() a._optional_user_add.return_value = True a.whitelist = {'bluedata'} + a.allowed_users = {'bluedata'} assert a._check_username_and_add_user('bluedata') a._optional_user_add.assert_called_once_with('bluedata') a.whitelist = {'not_bluedata'} + a.allowed_users = {'not_bluedata'} a._optional_user_add.reset_mock() assert not a._check_username_and_add_user('bluedata') @@ -636,12 +638,14 @@ def test_check_username_valid_username_no_white_lists(self): a._optional_user_add = MagicMock() a._optional_user_add.return_value = True a.blacklist = {'bluedata'} + a.blocked_users = {'bluedata'} assert not a._check_username_and_add_user('bluedata') a._optional_user_add.assert_not_called() a.blacklist = {'not_bluedata'} + a.blocked_users = {'blocked_users'} assert a._check_username_and_add_user('bluedata')