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 1010https://docs.djangoproject.com/en/4.2/ref/settings/
1111"""
1212
13+ import os
1314from pathlib import Path
1415
1516
3233# Application definition
3334
3435INSTALLED_APPS = [
36+ "idp.apps.IDPAppConfig" ,
3537 "django.contrib.admin" ,
3638 "django.contrib.auth" ,
3739 "django.contrib.contenttypes" ,
186188 "SCOPES" : {
187189 "openid" : "OpenID Connect scope" ,
188190 },
191+ "ALLOWED_SCHEMES" : ["https" , "http" ],
189192}
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"
193195
194196LOGGING = {
195197 "version" : 1 ,
210212 "level" : "DEBUG" ,
211213 "propagate" : False ,
212214 },
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+ # },
213221 },
214222}
You can’t perform that action at this time.
0 commit comments