File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change
1
+ from corsheaders .signals import check_request_enabled
2
+ from django .apps import AppConfig
3
+
4
+
5
+ def cors_allow_origin (sender , request , ** kwargs ):
6
+ return request .path == "/o/userinfo/" or request .path == "/o/userinfo"
7
+
8
+
9
+ class IDPAppConfig (AppConfig ):
10
+ name = "idp"
11
+ default = True
12
+
13
+ def ready (self ):
14
+ check_request_enabled .connect (cors_allow_origin )
Original file line number Diff line number Diff line change 10
10
https://docs.djangoproject.com/en/4.2/ref/settings/
11
11
"""
12
12
13
+ import os
13
14
from pathlib import Path
14
15
15
16
32
33
# Application definition
33
34
34
35
INSTALLED_APPS = [
36
+ "idp.apps.IDPAppConfig" ,
35
37
"django.contrib.admin" ,
36
38
"django.contrib.auth" ,
37
39
"django.contrib.contenttypes" ,
186
188
"SCOPES" : {
187
189
"openid" : "OpenID Connect scope" ,
188
190
},
191
+ "ALLOWED_SCHEMES" : ["https" , "http" ],
189
192
}
190
-
191
- # just for this example
192
- CORS_ORIGIN_ALLOW_ALL = True
193
+ # needs to be set to allow cors requests from the test app, along with ALLOWED_SCHEMES=["http"]
194
+ os .environ ["OAUTHLIB_INSECURE_TRANSPORT" ] = "1"
193
195
194
196
LOGGING = {
195
197
"version" : 1 ,
210
212
"level" : "DEBUG" ,
211
213
"propagate" : False ,
212
214
},
215
+ # occasionally you may want to see what's going on in upstream in oauthlib
216
+ # "oauthlib": {
217
+ # "handlers": ["console"],
218
+ # "level": "DEBUG",
219
+ # "propagate": False,
220
+ # },
213
221
},
214
222
}
You can’t perform that action at this time.
0 commit comments