Skip to content

Commit a30001f

Browse files
authored
Fix/test app rp openid configuration (#1362)
* fix: cors on .well-know redirect in test app (cherry picked from commit a592988) * fix: mismatched issuer origin for idp
1 parent 4f59b06 commit a30001f

File tree

5 files changed

+15
-21
lines changed

5 files changed

+15
-21
lines changed

tests/app/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Test Apps
22

33
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.
4+
local test environments. You should be able to start both and instance of the IDP and RP using the directions below, then test the
5+
functionality of the IDP using the RP.
56

67
## /tests/app/idp
78

@@ -29,7 +30,7 @@ password: password
2930
You can update data in the IDP and then dump the data to a new seed file as follows.
3031

3132
```
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+
python -Xutf8 ./manage.py dumpdata -e sessions -e admin.logentry -e auth.permission -e contenttypes.contenttype -e oauth2_provider.accesstoken -e oauth2_provider.refreshtoken -e oauth2_provider.idtoken --natural-foreign --natural-primary --indent 2 > fixtures/seed.json
3334
```
3435

3536
## /test/app/rp

tests/app/idp/README.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
11
# TEST IDP
22

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.*
3+
see ../README.md

tests/app/idp/fixtures/seed.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"model": "auth.user",
44
"fields": {
55
"password": "pbkdf2_sha256$390000$29LoVHfFRlvEOJ9clv73Wx$fx5ejfUJ+nYsnBXFf21jZvDsq4o3p5io3TrAGKAVTq4=",
6-
"last_login": "2023-10-05T14:39:15.980Z",
6+
"last_login": "2023-11-11T17:24:19.359Z",
77
"is_superuser": true,
88
"username": "superuser",
99
"first_name": "",
@@ -30,8 +30,9 @@
3030
"name": "OIDC - Authorization Code",
3131
"skip_authorization": true,
3232
"created": "2023-05-01T20:27:46.167Z",
33-
"updated": "2023-05-11T16:37:21.669Z",
34-
"algorithm": "RS256"
33+
"updated": "2023-11-11T17:23:44.643Z",
34+
"algorithm": "RS256",
35+
"allowed_origins": "http://localhost:5173\r\nhttp://127.0.0.1:5173"
3536
}
3637
}
3738
]

tests/app/idp/idp/apps.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33

44

55
def cors_allow_origin(sender, request, **kwargs):
6-
return request.path == "/o/userinfo/" or request.path == "/o/userinfo"
6+
return (
7+
request.path == "/o/userinfo/"
8+
or request.path == "/o/userinfo"
9+
or request.path == "/o/.well-known/openid-configuration"
10+
or request.path == "/o/.well-known/openid-configuration/"
11+
)
712

813

914
class IDPAppConfig(AppConfig):

tests/app/rp/src/routes/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const metadata = {};
2020

2121
{#if browser}
2222
<OidcContext
23-
issuer="http://127.0.0.1:8000/o"
23+
issuer="http://localhost:8000/o"
2424
client_id="2EIxgjlyy5VgCp2fjhEpKLyRtSMMPK0hZ0gBpNdm"
2525
redirect_uri="http://localhost:5173"
2626
post_logout_redirect_uri="http://localhost:5173"

0 commit comments

Comments
 (0)