diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 0000000..9b2ea36 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,43 @@ +name: coverage + +on: + pull_request: + push: + branches: + - master + +jobs: + codecov: + # --------------------------------------------------- + # Documentation and examples can be found at + # https://github.com/snok/install-poetry + # --------------------------------------------------- + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install poetry + uses: snok/install-poetry@v1.1.1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v2 + with: + path: .venv + key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + - name: Install dependencies + run: poetry install + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + - name: Test with pytest + run: | + poetry run coverage run manage.py test -v 2 + poetry run coverage xml + - name: Upload coverage + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + fail_ci_if_error: true diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 0000000..80176dd --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,72 @@ +name: test + +on: pull_request + +jobs: + linting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: "3" + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + - run: python -m pip install flake8 # isort black + - run: | + flake8 . +# black . --check +# isort . + test: + # --------------------------------------------------- + # Documentation and examples can be found at + # https://github.com/snok/install-poetry + # --------------------------------------------------- + needs: linting + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [ "3.6", "3.7", "3.8", "3.9"] + django-version: [ "2.2", "3.0", "3.1" ] + drf-version: [ "3.10", "3.11", "3.12" ] + steps: + - name: Check out repository + uses: actions/checkout@v2 + - name: Set up python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install poetry + uses: snok/install-poetry@v1.0.0 + with: + virtualenvs-create: true + virtualenvs-in-project: true + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v2 + with: + path: .venv + key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + - name: Install dependencies + run: poetry install + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + - name: Install django ${{ matrix.django-version }} + run: | + source .venv/bin/activate + poetry add "Django==${{ matrix.django-version }}" + - name: Install DRF + run: | + source .venv/bin/activate + poetry add "djangorestframework==${{ matrix.drf-version }}" + - run: pip install pyjwt==1.7.1 + - name: Run tests + run: | + source .venv/bin/activate + poetry run coverage run manage.py test -v 2 + poetry run coverage report -m diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 26c5dd1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,122 +0,0 @@ -# Config file for automatic testing at travis-ci.org - -dist: xenial -language: python -matrix: - include: - - python: 3.5 - env: TOXENV=py35-django111-drf38 - - python: 3.5 - env: TOXENV=py35-django111-drf39 - - python: 3.5 - env: TOXENV=py35-django111-drf310 - - python: 3.5 - env: TOXENV=py35-django20-drf38 - - python: 3.5 - env: TOXENV=py35-django20-drf39 - - python: 3.5 - env: TOXENV=py35-django20-drf310 - - python: 3.5 - env: TOXENV=py35-django21-drf38 - - python: 3.5 - env: TOXENV=py35-django21-drf39 - - python: 3.5 - env: TOXENV=py35-django21-drf310 - - python: 3.5 - env: TOXENV=py35-django22-drf38 - - python: 3.5 - env: TOXENV=py35-django22-drf39 - - python: 3.5 - env: TOXENV=py35-django22-drf310 - - - python: 3.6 - env: TOXENV=py36-django111-drf38 - - python: 3.6 - env: TOXENV=py36-django111-drf39 - - python: 3.6 - env: TOXENV=py36-django111-drf310 - - python: 3.6 - env: TOXENV=py36-django20-drf38 - - python: 3.6 - env: TOXENV=py36-django20-drf39 - - python: 3.6 - env: TOXENV=py36-django20-drf310 - - python: 3.6 - env: TOXENV=py36-django21-drf38 - - python: 3.6 - env: TOXENV=py36-django21-drf39 - - python: 3.6 - env: TOXENV=py36-django21-drf310 - - python: 3.6 - env: TOXENV=py36-django22-drf38 - - python: 3.6 - env: TOXENV=py36-django22-drf39 - - python: 3.6 - env: TOXENV=py36-django22-drf310 - - - python: 3.7 - env: TOXENV=py37-django111-drf38 - - python: 3.7 - env: TOXENV=py37-django111-drf39 - - python: 3.7 - env: TOXENV=py37-django111-drf310 - - python: 3.7 - env: TOXENV=py37-django20-drf38 - - python: 3.7 - env: TOXENV=py37-django20-drf39 - - python: 3.7 - env: TOXENV=py37-django20-drf310 - - python: 3.7 - env: TOXENV=py37-django21-drf38 - - python: 3.7 - env: TOXENV=py37-django21-drf39 - - python: 3.7 - env: TOXENV=py37-django21-drf310 - - python: 3.7 - env: TOXENV=py37-django22-drf38 - - python: 3.7 - env: TOXENV=py37-django22-drf39 - - python: 3.7 - env: TOXENV=py37-django22-drf310 - - - python: 3.8 - env: TOXENV=py38-django111-drf38 - - python: 3.8 - env: TOXENV=py38-django111-drf39 - - python: 3.8 - env: TOXENV=py38-django111-drf310 - - python: 3.8 - env: TOXENV=py38-django20-drf38 - - python: 3.8 - env: TOXENV=py38-django20-drf39 - - python: 3.8 - env: TOXENV=py38-django20-drf310 - - python: 3.8 - env: TOXENV=py38-django21-drf38 - - python: 3.8 - env: TOXENV=py38-django21-drf39 - - python: 3.8 - env: TOXENV=py38-django21-drf310 - - python: 3.8 - env: TOXENV=py38-django22-drf38 - - python: 3.8 - env: TOXENV=py38-django22-drf39 - - python: 3.8 - env: TOXENV=py38-django22-drf310 - - - python: 3.8 - env: TOXENV=flake8 - - - python: 3.8 - env: TOXENV=docs - -# command to install dependencies for getting Tox running, other dependencies are installed by Tox -before_install: - - pip install codecov tox - -# command to run tests, e.g. python setup.py test -script: - - tox - -after_success: - - codecov -e TOXENV diff --git a/README.rst b/README.rst index d21362d..321d665 100644 --- a/README.rst +++ b/README.rst @@ -10,15 +10,15 @@ ADFS Authentication for Django :target: https://pypi.python.org/pypi/django-auth-adfs#downloads .. image:: https://img.shields.io/pypi/djversions/django-auth-adfs.svg :target: https://pypi.python.org/pypi/django-auth-adfs -.. image:: https://travis-ci.org/jobec/django-auth-adfs.svg?branch=master - :target: https://travis-ci.org/jobec/django-auth-adfs -.. image:: https://codecov.io/github/jobec/django-auth-adfs/coverage.svg?branch=master - :target: https://codecov.io/github/jobec/django-auth-adfs?branch=master +.. image:: https://travis-ci.org/snok/django-auth-adfs.svg?branch=master + :target: https://travis-ci.org/snok/django-auth-adfs +.. image:: https://codecov.io/github/snok/django-auth-adfs/coverage.svg?branch=master + :target: https://codecov.io/github/snok/django-auth-adfs?branch=master A Django authentication backend for Microsoft ADFS and Azure AD * Free software: BSD License -* Homepage: https://github.com/jobec/django-auth-adfs +* Homepage: https://github.com/snok/django-auth-adfs * Documentation: http://django-auth-adfs.readthedocs.io/ Features diff --git a/django_auth_adfs/exceptions.py b/django_auth_adfs/exceptions.py index 391a8e0..f35afd6 100644 --- a/django_auth_adfs/exceptions.py +++ b/django_auth_adfs/exceptions.py @@ -3,4 +3,3 @@ class MFARequired(Exception): Exception to indicate that a MFA auth is required. """ pass - diff --git a/docs/index.rst b/docs/index.rst index 35f6de6..d940310 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,15 +10,15 @@ ADFS Authentication for Django :target: https://pypi.python.org/pypi/django-auth-adfs#downloads .. image:: https://img.shields.io/pypi/djversions/django-auth-adfs.svg :target: https://pypi.python.org/pypi/django-auth-adfs -.. image:: https://travis-ci.org/jobec/django-auth-adfs.svg?branch=master - :target: https://travis-ci.org/jobec/django-auth-adfs -.. image:: https://codecov.io/github/jobec/django-auth-adfs/coverage.svg?branch=master - :target: https://codecov.io/github/jobec/django-auth-adfs?branch=master +.. image:: https://travis-ci.org/snok/django-auth-adfs.svg?branch=master + :target: https://travis-ci.org/snok/django-auth-adfs +.. image:: https://codecov.io/github/snok/django-auth-adfs/coverage.svg?branch=master + :target: https://codecov.io/github/snok/django-auth-adfs?branch=master A Django authentication backend for Microsoft ADFS and Azure AD * Free software: BSD License -* Homepage: https://github.com/jobec/django-auth-adfs +* Homepage: https://github.com/snok/django-auth-adfs * Documentation: http://django-auth-adfs.readthedocs.io/ Features diff --git a/poetry.lock b/poetry.lock index ddd8725..640af6f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,11 +1,3 @@ -[[package]] -name = "appdirs" -version = "1.4.4" -description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -category = "dev" -optional = false -python-versions = "*" - [[package]] name = "asgiref" version = "3.3.1" @@ -44,14 +36,6 @@ category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -[[package]] -name = "colorama" -version = "0.4.4" -description = "Cross-platform colored terminal text." -category = "dev" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" - [[package]] name = "coverage" version = "5.3.1" @@ -82,14 +66,6 @@ pep8test = ["black", "flake8", "flake8-import-order", "pep8-naming"] ssh = ["bcrypt (>=3.1.5)"] test = ["pytest (>=3.6.0,!=3.9.0,!=3.9.1,!=3.9.2)", "pretend", "iso8601", "pytz", "hypothesis (>=1.11.4,!=3.79.2)"] -[[package]] -name = "distlib" -version = "0.3.1" -description = "Distribution utilities" -category = "dev" -optional = false -python-versions = "*" - [[package]] name = "django" version = "3.1.5" @@ -118,14 +94,6 @@ python-versions = ">=3.5" [package.dependencies] django = ">=2.2" -[[package]] -name = "filelock" -version = "3.0.12" -description = "A platform independent file lock." -category = "dev" -optional = false -python-versions = "*" - [[package]] name = "idna" version = "2.10" @@ -134,37 +102,6 @@ category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -[[package]] -name = "importlib-metadata" -version = "3.4.0" -description = "Read metadata from Python packages" -category = "dev" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} -zipp = ">=0.5" - -[package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] - -[[package]] -name = "importlib-resources" -version = "5.1.0" -description = "Read resources from Python packages" -category = "dev" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -zipp = {version = ">=0.4", markers = "python_version < \"3.8\""} - -[package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "pytest-black (>=0.3.7)", "pytest-mypy"] - [[package]] name = "mock" version = "4.0.3" @@ -178,39 +115,6 @@ build = ["twine", "wheel", "blurb"] docs = ["sphinx"] test = ["pytest (<5.4)", "pytest-cov"] -[[package]] -name = "packaging" -version = "20.8" -description = "Core utilities for Python packages" -category = "dev" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" - -[package.dependencies] -pyparsing = ">=2.0.2" - -[[package]] -name = "pluggy" -version = "0.13.1" -description = "plugin and hook calling mechanisms for python" -category = "dev" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" - -[package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} - -[package.extras] -dev = ["pre-commit", "tox"] - -[[package]] -name = "py" -version = "1.10.0" -description = "library with cross-python path, ini-parsing, io, code, log facilities" -category = "dev" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" - [[package]] name = "pycparser" version = "2.20" @@ -233,14 +137,6 @@ dev = ["sphinx", "sphinx-rtd-theme", "zope.interface", "cryptography (>=3.3.1,<4 docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"] tests = ["pytest (>=6.0.0,<7.0.0)", "coverage[toml] (==5.0.4)"] -[[package]] -name = "pyparsing" -version = "2.4.7" -description = "Python parsing module" -category = "dev" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" - [[package]] name = "pytz" version = "2020.5" @@ -299,45 +195,6 @@ category = "main" optional = false python-versions = ">=3.5" -[[package]] -name = "toml" -version = "0.10.2" -description = "Python Library for Tom's Obvious, Minimal Language" -category = "dev" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" - -[[package]] -name = "tox" -version = "3.21.1" -description = "tox is a generic virtualenv management and test command line tool" -category = "dev" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" - -[package.dependencies] -colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""} -filelock = ">=3.0.0" -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} -packaging = ">=14" -pluggy = ">=0.12.0" -py = ">=1.4.17" -six = ">=1.14.0" -toml = ">=0.9.4" -virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7" - -[package.extras] -docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"] -testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "psutil (>=5.6.1)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)", "pytest-xdist (>=1.22.2)", "pathlib2 (>=2.3.3)"] - -[[package]] -name = "typing-extensions" -version = "3.7.4.3" -description = "Backported and Experimental Type Hints for Python 3.5+" -category = "dev" -optional = false -python-versions = "*" - [[package]] name = "urllib3" version = "1.26.2" @@ -351,48 +208,12 @@ brotli = ["brotlipy (>=0.6.0)"] secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] -[[package]] -name = "virtualenv" -version = "20.3.1" -description = "Virtual Python Environment builder" -category = "dev" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" - -[package.dependencies] -appdirs = ">=1.4.3,<2" -distlib = ">=0.3.1,<1" -filelock = ">=3.0.0,<4" -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} -importlib-resources = {version = ">=1.0", markers = "python_version < \"3.7\""} -six = ">=1.9.0,<2" - -[package.extras] -docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=19.9.0rc1)"] -testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "packaging (>=20.0)", "xonsh (>=0.9.16)"] - -[[package]] -name = "zipp" -version = "3.4.0" -description = "Backport of pathlib-compatible object wrapper for zip files" -category = "dev" -optional = false -python-versions = ">=3.6" - -[package.extras] -docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] - [metadata] lock-version = "1.1" python-versions = '^3.6' -content-hash = "cd97cd371c741e195f15c505f563f0f8fef1b457244a4ad55b6090c59be11d18" +content-hash = "1d423e38be63b231e838798ef57f76d8515a963f1ec54ab9426fac445c161c11" [metadata.files] -appdirs = [ - {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, - {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, -] asgiref = [ {file = "asgiref-3.3.1-py3-none-any.whl", hash = "sha256:5ee950735509d04eb673bd7f7120f8fa1c9e2df495394992c73234d526907e17"}, {file = "asgiref-3.3.1.tar.gz", hash = "sha256:7162a3cb30ab0609f1a4c95938fd73e8604f63bdba516a7f7d64b83ff09478f0"}, @@ -441,10 +262,6 @@ chardet = [ {file = "chardet-4.0.0-py2.py3-none-any.whl", hash = "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"}, {file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"}, ] -colorama = [ - {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, - {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, -] coverage = [ {file = "coverage-5.3.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:fabeeb121735d47d8eab8671b6b031ce08514c86b7ad8f7d5490a7b6dcd6267d"}, {file = "coverage-5.3.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:7e4d159021c2029b958b2363abec4a11db0ce8cd43abb0d9ce44284cb97217e7"}, @@ -512,10 +329,6 @@ cryptography = [ {file = "cryptography-3.3.1-cp36-abi3-win_amd64.whl", hash = "sha256:0e85aaae861d0485eb5a79d33226dd6248d2a9f133b81532c8f5aae37de10ff7"}, {file = "cryptography-3.3.1.tar.gz", hash = "sha256:7e177e4bea2de937a584b13645cab32f25e3d96fc0bc4a4cf99c27dc77682be6"}, ] -distlib = [ - {file = "distlib-0.3.1-py2.py3-none-any.whl", hash = "sha256:8c09de2c67b3e7deef7184574fc060ab8a793e7adbb183d942c389c8b13c52fb"}, - {file = "distlib-0.3.1.zip", hash = "sha256:edf6116872c863e1aa9d5bb7cb5e05a022c519a4594dc703843343a9ddd9bff1"}, -] django = [ {file = "Django-3.1.5-py3-none-any.whl", hash = "sha256:efa2ab96b33b20c2182db93147a0c3cd7769d418926f9e9f140a60dca7c64ca9"}, {file = "Django-3.1.5.tar.gz", hash = "sha256:2d78425ba74c7a1a74b196058b261b9733a8570782f4e2828974777ccca7edf7"}, @@ -523,38 +336,14 @@ django = [ djangorestframework = [ {file = "djangorestframework-3.12.2-py3-none-any.whl", hash = "sha256:0209bafcb7b5010fdfec784034f059d512256424de2a0f084cb82b096d6dd6a7"}, ] -filelock = [ - {file = "filelock-3.0.12-py3-none-any.whl", hash = "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"}, - {file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"}, -] idna = [ {file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"}, {file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"}, ] -importlib-metadata = [ - {file = "importlib_metadata-3.4.0-py3-none-any.whl", hash = "sha256:ace61d5fc652dc280e7b6b4ff732a9c2d40db2c0f92bc6cb74e07b73d53a1771"}, - {file = "importlib_metadata-3.4.0.tar.gz", hash = "sha256:fa5daa4477a7414ae34e95942e4dd07f62adf589143c875c133c1e53c4eff38d"}, -] -importlib-resources = [ - {file = "importlib_resources-5.1.0-py3-none-any.whl", hash = "sha256:885b8eae589179f661c909d699a546cf10d83692553e34dca1bf5eb06f7f6217"}, - {file = "importlib_resources-5.1.0.tar.gz", hash = "sha256:bfdad047bce441405a49cf8eb48ddce5e56c696e185f59147a8b79e75e9e6380"}, -] mock = [ {file = "mock-4.0.3-py3-none-any.whl", hash = "sha256:122fcb64ee37cfad5b3f48d7a7d51875d7031aaf3d8be7c42e2bee25044eee62"}, {file = "mock-4.0.3.tar.gz", hash = "sha256:7d3fbbde18228f4ff2f1f119a45cdffa458b4c0dee32eb4d2bb2f82554bac7bc"}, ] -packaging = [ - {file = "packaging-20.8-py2.py3-none-any.whl", hash = "sha256:24e0da08660a87484d1602c30bb4902d74816b6985b93de36926f5bc95741858"}, - {file = "packaging-20.8.tar.gz", hash = "sha256:78598185a7008a470d64526a8059de9aaa449238f280fc9eb6b13ba6c4109093"}, -] -pluggy = [ - {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, - {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, -] -py = [ - {file = "py-1.10.0-py2.py3-none-any.whl", hash = "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"}, - {file = "py-1.10.0.tar.gz", hash = "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3"}, -] pycparser = [ {file = "pycparser-2.20-py2.py3-none-any.whl", hash = "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705"}, {file = "pycparser-2.20.tar.gz", hash = "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"}, @@ -563,10 +352,6 @@ pyjwt = [ {file = "PyJWT-2.0.1-py3-none-any.whl", hash = "sha256:b70b15f89dc69b993d8a8d32c299032d5355c82f9b5b7e851d1a6d706dffe847"}, {file = "PyJWT-2.0.1.tar.gz", hash = "sha256:a5c70a06e1f33d81ef25eecd50d50bd30e34de1ca8b2b9fa3fe0daaabcf69bf7"}, ] -pyparsing = [ - {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, - {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, -] pytz = [ {file = "pytz-2020.5-py2.py3-none-any.whl", hash = "sha256:16962c5fb8db4a8f63a26646d8886e9d769b6c511543557bc84e9569fb9a9cb4"}, {file = "pytz-2020.5.tar.gz", hash = "sha256:180befebb1927b16f6b57101720075a984c019ac16b1b7575673bea42c6c3da5"}, @@ -587,28 +372,7 @@ sqlparse = [ {file = "sqlparse-0.4.1-py3-none-any.whl", hash = "sha256:017cde379adbd6a1f15a61873f43e8274179378e95ef3fede90b5aa64d304ed0"}, {file = "sqlparse-0.4.1.tar.gz", hash = "sha256:0f91fd2e829c44362cbcfab3e9ae12e22badaa8a29ad5ff599f9ec109f0454e8"}, ] -toml = [ - {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, - {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, -] -tox = [ - {file = "tox-3.21.1-py2.py3-none-any.whl", hash = "sha256:8a28facf65275c84b3bfde102afe24541d2ce02fd83ea07ce906537c3a74ed2d"}, - {file = "tox-3.21.1.tar.gz", hash = "sha256:31379f2662393034203c5d6b2ebb7b86c67452cfc689784475c1c6e4a3cbc0cd"}, -] -typing-extensions = [ - {file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"}, - {file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"}, - {file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"}, -] urllib3 = [ {file = "urllib3-1.26.2-py2.py3-none-any.whl", hash = "sha256:d8ff90d979214d7b4f8ce956e80f4028fc6860e4431f731ea4a8c08f23f99473"}, {file = "urllib3-1.26.2.tar.gz", hash = "sha256:19188f96923873c92ccb987120ec4acaa12f0461fa9ce5d3d0772bc965a39e08"}, ] -virtualenv = [ - {file = "virtualenv-20.3.1-py2.py3-none-any.whl", hash = "sha256:14b34341e742bdca219e10708198e704e8a7064dd32f474fc16aca68ac53a306"}, - {file = "virtualenv-20.3.1.tar.gz", hash = "sha256:0c111a2236b191422b37fe8c28b8c828ced39aab4bf5627fa5c331aeffb570d9"}, -] -zipp = [ - {file = "zipp-3.4.0-py3-none-any.whl", hash = "sha256:102c24ef8f171fd729d46599845e95c7ab894a4cf45f5de11a44cc7444fb1108"}, - {file = "zipp-3.4.0.tar.gz", hash = "sha256:ed5eee1974372595f9e416cc7bbeeb12335201d8081ca8a0743c954d4446e5cb"}, -] diff --git a/pyproject.toml b/pyproject.toml index f295128..de53578 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,9 +12,6 @@ keywords = ['django', 'authentication', 'adfs', 'azure', 'ad', 'oauth2'] readme = 'README.rst' classifiers=[ 'Environment :: Web Environment', - 'Framework :: Django :: 1.11', - 'Framework :: Django :: 2.0', - 'Framework :: Django :: 2.1', 'Framework :: Django :: 2.2', 'Framework :: Django :: 3.0', 'Framework :: Django :: 3.1', @@ -39,7 +36,7 @@ include = ['CHANGELOG.rst'] [tool.poetry.dependencies] python = '^3.6' -django = ' ^3.0 ||^2.0 || ^1.1' +django = '^3.0 ||^2.2' requests = '^1 || ^2' cryptography = '^1.7 || ^2.0 || ^3.0' PyJWT = "^1.3.0 || ^2.0" @@ -48,7 +45,6 @@ PyJWT = "^1.3.0 || ^2.0" responses = '*' mock = '*' coverage = '*' -tox = '*' djangorestframework = '*' [build-system] diff --git a/setup.cfg b/setup.cfg index 6deafc2..01839b1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,5 @@ [flake8] max-line-length = 120 +exclude = + docs/* + .venv diff --git a/tests/test_authentication.py b/tests/test_authentication.py index d310ded..d831793 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -60,7 +60,7 @@ def test_with_auth_code_2016(self): self.assertEqual(user.groups.all()[1].name, "group2") @mock_adfs("2016", mfa_error=True) - def test_mfa_error(self): + def test_mfa_error_backends(self): with self.assertRaises(MFARequired): backend = AdfsAuthCodeBackend() backend.authenticate(self.request, authorization_code="dummycode") @@ -160,7 +160,7 @@ def test_group_removal_overlap(self): def test_authentication(self): response = self.client.get("/oauth2/callback", {'code': 'testcode'}) self.assertEqual(response.status_code, 302) - self.assertEqual(response['Location'], "/")\ + self.assertEqual(response['Location'], "/") @mock_adfs("2016") def test_mfa_error(self): diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 62a439b..0000000 --- a/tox.ini +++ /dev/null @@ -1,42 +0,0 @@ -[tox] -envlist = - py{35,36,37,38}-django{111,20,21,22}-drf{38,39,310} - flake8 - docs -isolated_build = true -skipsdist = true - -[testenv] -whitelist_externals = poetry -deps = - coverage - mock - responses - pyjwt==1.7.1 - django111: Django>=1.11,<1.12 - django20: Django>=2.0,<2.1 - django21: Django>=2.1,<2.2 - django22: Django>=2.2,<2.3 - drf38: djangorestframework>=3.8,<3.9 - drf39: djangorestframework>=3.9<3.10 - drf310: djangorestframework>=3.10<3.11 -commands = - poetry install -v - poetry run coverage run manage.py test -v 2 - poetry run coverage report -m - poetry run coverage html - -[testenv:flake8] -deps = - flake8 - pep8-naming - flake8-builtins -commands = - flake8 tests django_auth_adfs - -[testenv:docs] -deps = - sphinx - sphinx_rtd_theme -commands = - sphinx-build -W -n -b html ./docs {envtmpdir}/html