Skip to content

Commit 0fcb5df

Browse files
Merge branch 'master' into cors-oauthlib
2 parents f1b70ce + efdf897 commit 0fcb5df

31 files changed

+2357
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ _build
5151

5252
/venv/
5353
/coverage.xml
54+
55+
db.sqlite3
56+
venv/

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
- id: black
66
exclude: ^(oauth2_provider/migrations/|tests/migrations/)
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.4.0
8+
rev: v4.5.0
99
hooks:
1010
- id: check-ast
1111
- id: trailing-whitespace

AUTHORS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Alan Crosswell
1515
Alejandro Mantecon Guillen
1616
Aleksander Vaskevich
1717
Alessandro De Angelis
18+
Alex Manning
1819
Alex Szabó
1920
Aliaksei Kanstantsinau
2021
Allisson Azevedo
@@ -71,6 +72,7 @@ Jun Zhou
7172
Kaleb Porter
7273
Kristian Rune Larsen
7374
Ludwig Hähne
75+
Łukasz Skarżyński
7476
Marcus Sonestedt
7577
Matias Seniquiel
7678
Michael Howitz
@@ -83,6 +85,7 @@ Peter Carnesciali
8385
Peter Karman
8486
Peter McDonald
8587
Petr Dlouhý
88+
pySilver
8689
Rodney Richardson
8790
Rustem Saiargaliev
8891
Rustem Saiargaliev
@@ -97,6 +100,4 @@ Tom Evans
97100
Vinay Karanam
98101
Víðir Valberg Guðmundsson
99102
Will Beaufoy
100-
pySilver
101-
Łukasz Skarżyński
102103
Yuri Savin

oauth2_provider/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from .utils import jwk_from_pem
2323
from .validators import RedirectURIValidator, URIValidator, WildcardSet, AllowedURIValidator
2424

25+
2526
logger = logging.getLogger(__name__)
2627

2728

oauth2_provider/oauth2_validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _authenticate_request_body(self, request):
190190
if self._load_application(client_id, request) is None:
191191
log.debug("Failed body auth: Application %s does not exists" % client_id)
192192
return False
193-
elif not check_password(client_secret, request.client.client_secret):
193+
elif not self._check_secret(client_secret, request.client.client_secret):
194194
log.debug("Failed body auth: wrong client secret %s" % client_secret)
195195
return False
196196
else:

tests/app/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Test Apps
2+
3+
These apps are for local end to end testing of DOT features. They were implemented to save maintainers the trouble of setting up
4+
local test environments.
5+
6+
## /tests/app/idp
7+
8+
This is an example IDP implementation for end to end testing. There are pre-configured fixtures which will work with the sample RP.
9+
10+
username: superuser
11+
password: password
12+
13+
### Development Tasks
14+
15+
* starting up the idp
16+
17+
```bash
18+
cd tests/app/idp
19+
# create a virtual env if that is something you do
20+
python manage.py migrate
21+
python manage.py loaddata fixtures/seed.json
22+
python manage.py runserver
23+
# open http://localhost:8000/admin
24+
25+
```
26+
27+
* update fixtures
28+
29+
You can update data in the IDP and then dump the data to a new seed file as follows.
30+
31+
```
32+
python -Xutf8 ./manage.py dumpdata -e sessions -e admin.logentry -e auth.permission -e contenttypes.contenttype --natural-foreign --natural-primary --indent 2 > fixtures/seed.json
33+
```
34+
35+
## /test/app/rp
36+
37+
This is an example RP. It is a SPA built with Svelte.
38+
39+
### Development Tasks
40+
41+
* starting the RP
42+
43+
```bash
44+
cd test/apps/rp
45+
npm install
46+
npm run dev
47+
# open http://localhost:5173
48+
```

tests/app/idp/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# TEST IDP
2+
3+
This is an example IDP implementation for end to end testing.
4+
5+
username: superuser
6+
password: password
7+
8+
## Development Tasks
9+
10+
* update fixtures
11+
12+
```
13+
python -Xutf8 ./manage.py dumpdata -e sessions -e admin.logentry -e auth.permission -e contenttypes.contenttype -e oauth2_provider.grant -e oauth2_provider.accesstoken -e oauth2_provider.refreshtoken -e oauth2_provider.idtoken --natural-foreign --natural-primary --indent 2 > fixtures/seed.json
14+
```
15+
16+
*check seeds as you produce them to makre sure any unrequired models are excluded to keep our seeds as small as possible.*

tests/app/idp/fixtures/seed.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[
2+
{
3+
"model": "auth.user",
4+
"fields": {
5+
"password": "pbkdf2_sha256$390000$29LoVHfFRlvEOJ9clv73Wx$fx5ejfUJ+nYsnBXFf21jZvDsq4o3p5io3TrAGKAVTq4=",
6+
"last_login": "2023-10-05T14:39:15.980Z",
7+
"is_superuser": true,
8+
"username": "superuser",
9+
"first_name": "",
10+
"last_name": "",
11+
"email": "",
12+
"is_staff": true,
13+
"is_active": true,
14+
"date_joined": "2023-05-01T19:53:59.622Z",
15+
"groups": [],
16+
"user_permissions": []
17+
}
18+
},
19+
{
20+
"model": "oauth2_provider.application",
21+
"fields": {
22+
"client_id": "2EIxgjlyy5VgCp2fjhEpKLyRtSMMPK0hZ0gBpNdm",
23+
"user": null,
24+
"redirect_uris": "http://localhost:5173\r\nhttp://127.0.0.1:5173",
25+
"post_logout_redirect_uris": "http://localhost:5173\r\nhttp://127.0.0.1:5173",
26+
"client_type": "public",
27+
"authorization_grant_type": "authorization-code",
28+
"client_secret": "pbkdf2_sha256$600000$HEYByn6WXiQUI1D6ezTnAf$qPLekt0t3ZssnzEOvQkeOSfxx7tbs/gcC3O0CthtP2A=",
29+
"hash_client_secret": true,
30+
"name": "OIDC - Authorization Code",
31+
"skip_authorization": true,
32+
"created": "2023-05-01T20:27:46.167Z",
33+
"updated": "2023-05-11T16:37:21.669Z",
34+
"algorithm": "RS256"
35+
}
36+
}
37+
]

tests/app/idp/idp/__init__.py

Whitespace-only changes.

tests/app/idp/idp/asgi.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
ASGI config for idp project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
15+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "idp.settings")
16+
17+
application = get_asgi_application()

0 commit comments

Comments
 (0)