Skip to content

Commit f4f46c2

Browse files
committed
Merge remote-tracking branch 'upstream/master' into honor-database-assigment-from-router
2 parents 8ff18e8 + 9fceef1 commit f4f46c2

34 files changed

+284
-237
lines changed

.github/workflows/lint.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ruff:
7+
name: Ruff
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Set up Python
12+
uses: actions/setup-python@v5
13+
with:
14+
python-version: "3.10"
15+
- name: Install Ruff
16+
run: |
17+
python -m pip install ruff>=0.6
18+
- name: Lint using Ruff
19+
run: |
20+
ruff format --check
21+
ruff check

.github/workflows/release.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,17 @@ jobs:
1616
fetch-depth: 0
1717

1818
- name: Set up Python
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: '3.12'
2222

2323
- name: Install dependencies
2424
run: |
25-
python -m pip install -U pip
26-
python -m pip install -U setuptools twine wheel
25+
python -m pip install -U pip build twine
2726
2827
- name: Build package
2928
run: |
30-
python setup.py --version
31-
python setup.py sdist --format=gztar bdist_wheel
29+
python -m build
3230
twine check dist/*
3331
3432
- name: Upload packages to Jazzband

.github/workflows/test.yml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,26 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
python-version:
13-
- '3.8'
14-
- '3.9'
1513
- '3.10'
1614
- '3.11'
1715
- '3.12'
1816
django-version:
19-
- '3.2'
20-
- '4.0'
21-
- '4.1'
2217
- '4.2'
2318
- '5.0'
19+
- '5.1'
2420
- 'main'
25-
exclude:
21+
include:
2622
# https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django
27-
28-
# < Python 3.10 is not supported by Django 5.0+
29-
- python-version: '3.8'
30-
django-version: '5.0'
31-
- python-version: '3.9'
32-
django-version: '5.0'
3323
- python-version: '3.8'
34-
django-version: 'main'
24+
django-version: '4.2'
3525
- python-version: '3.9'
36-
django-version: 'main'
37-
38-
# Python 3.12 is not supported by Django < 5.0
39-
- python-version: '3.12'
40-
django-version: '3.2'
41-
- python-version: '3.12'
42-
django-version: '4.0'
43-
- python-version: '3.12'
44-
django-version: '4.1'
45-
- python-version: '3.12'
4626
django-version: '4.2'
4727

4828
steps:
4929
- uses: actions/checkout@v4
5030

5131
- name: Set up Python ${{ matrix.python-version }}
52-
uses: actions/setup-python@v4
32+
uses: actions/setup-python@v5
5333
with:
5434
python-version: ${{ matrix.python-version }}
5535

@@ -64,7 +44,7 @@ jobs:
6444
with:
6545
path: ${{ steps.pip-cache.outputs.dir }}
6646
key:
67-
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/tox.ini') }}
47+
${{ matrix.python-version }}-v1-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('**/tox.ini') }}
6848
restore-keys: |
6949
${{ matrix.python-version }}-v1-
7050

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pip-log.txt
3030
.coverage
3131
.tox
3232
.pytest_cache/
33+
.ruff_cache/
3334
nosetests.xml
3435

3536
# Translations

.pre-commit-config.yaml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 24.8.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.6.0
44
hooks:
5-
- id: black
6-
exclude: ^(oauth2_provider/migrations/|tests/migrations/)
5+
- id: ruff
6+
args: [ --fix ]
7+
- id: ruff-format
78
- repo: https://github.com/pre-commit/pre-commit-hooks
89
rev: v4.6.0
910
hooks:
@@ -15,16 +16,6 @@ repos:
1516
- id: check-yaml
1617
- id: mixed-line-ending
1718
args: ['--fix=lf']
18-
- repo: https://github.com/PyCQA/isort
19-
rev: 5.13.2
20-
hooks:
21-
- id: isort
22-
exclude: ^(oauth2_provider/migrations/|tests/migrations/)
23-
- repo: https://github.com/PyCQA/flake8
24-
rev: 7.1.1
25-
hooks:
26-
- id: flake8
27-
exclude: ^(oauth2_provider/migrations/|tests/migrations/)
2819
- repo: https://github.com/sphinx-contrib/sphinx-lint
2920
rev: v0.9.1
3021
hooks:

AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Dylan Tack
5151
Eduardo Oliveira
5252
Egor Poderiagin
5353
Emanuele Palazzetti
54+
Fazeel Ghafoor
5455
Federico Dolce
5556
Florian Demmer
5657
Frederico Vieira
@@ -104,6 +105,7 @@ Sandro Rodrigues
104105
Sean 'Shaleh' Perry
105106
Shaheed Haque
106107
Shaun Stanworth
108+
Sayyid Hamid Mahdavi
107109
Silvano Cerza
108110
Sora Yanai
109111
Sören Wegener

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
## [unreleased]
1818
### Added
19+
* Add migration to include `token_checksum` field in AbstractAccessToken model.
20+
* Added compatibility with `LoginRequiredMiddleware` introduced in Django 5.1
1921
* #1404 Add a new setting `REFRESH_TOKEN_REUSE_PROTECTION`
2022
### Changed
23+
* Update token to TextField from CharField with 255 character limit and SHA-256 checksum in AbstractAccessToken model. Removing the 255 character limit enables supporting JWT tokens with additional claims
24+
* Update middleware, validators, and views to use token checksums instead of token for token retrieval and validation.
25+
* #1446 use generic models pk instead of id.
2126
* Transactions wrapping writes of the Tokens now rely on Django's database routers to determine the correct
2227
database to use instead of assuming that 'default' is the correct one.
2328

2429
### Deprecated
2530
### Removed
2631
* #1425 Remove deprecated `RedirectURIValidator`, `WildcardSet` per #1345; `validate_logout_request` per #1274
32+
* Remove support for Django versions below 4.2
2733

2834
### Fixed
2935
* #1443 Query strings with invalid hex values now raise a SuspiciousOperation exception (in DRF extension) instead of raising a 500 ValueError: Invalid hex encoding in query string.

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Requirements
4444
------------
4545

4646
* Python 3.8+
47-
* Django 3.2, 4.0 (4.0.1+ due to a regression), 4.1, 4.2, or 5.0
47+
* Django 4.2, 5.0 or 5.1
4848
* oauthlib 3.1+
4949

5050
Installation

docs/contributing.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,26 @@ add a comment stating you're working on it.
2727
Code Style
2828
==========
2929

30-
The project uses `flake8 <https://flake8.pycqa.org/en/latest/>`_ for linting,
31-
`black <https://black.readthedocs.io/en/stable/>`_ for formatting the code,
32-
`isort <https://pycqa.github.io/isort/>`_ for formatting and sorting imports,
33-
and `pre-commit <https://pre-commit.com/>`_ for checking/fixing commits for
34-
correctness before they are made.
30+
The project uses `ruff <https://docs.astral.sh/ruff/>`_ for linting, formatting the code and sorting imports,
31+
and `pre-commit <https://pre-commit.com/>`_ for checking/fixing commits for correctness before they are made.
3532

3633
You will need to install ``pre-commit`` yourself, and then ``pre-commit`` will
37-
take care of installing ``flake8``, ``black`` and ``isort``.
34+
take care of installing ``ruff``.
3835

3936
After cloning your repository, go into it and run::
4037

4138
pre-commit install
4239

4340
to install the hooks. On the next commit that you make, ``pre-commit`` will
4441
download and install the necessary hooks (a one off task). If anything in the
45-
commit would fail the hooks, the commit will be abandoned. For ``black`` and
46-
``isort``, any necessary changes will be made automatically, but not staged.
42+
commit would fail the hooks, the commit will be abandoned. For ``ruff``, any
43+
necessary changes will be made automatically, but not staged.
4744
Review the changes, and then re-stage and commit again.
4845

4946
Using ``pre-commit`` ensures that code that would fail in QA does not make it
5047
into a commit in the first place, and will save you time in the long run. You
5148
can also (largely) stop worrying about code style, although you should always
52-
check how the code looks after ``black`` has formatted it, and think if there
49+
check how the code looks after ``ruff`` has formatted it, and think if there
5350
is a better way to structure the code so that it is more readable.
5451

5552
Documentation
@@ -265,7 +262,7 @@ add a comment. If you think a function is not trivial, add a docstrings.
265262

266263
To see if your code formatting will pass muster use::
267264

268-
tox -e flake8
265+
tox -e lint
269266

270267
The contents of this page are heavily based on the docs from `django-admin2 <https://github.com/twoscoops/django-admin2>`_
271268

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Requirements
2222
------------
2323

2424
* Python 3.8+
25-
* Django 3.2, 4.0 (4.0.1+ due to a regression), 4.1, 4.2, or 5.0
25+
* Django 4.2, 5.0 or 5.1
2626
* oauthlib 3.1+
2727

2828
Index

0 commit comments

Comments
 (0)