Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/app/idp/idp/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from corsheaders.signals import check_request_enabled
from django.apps import AppConfig


def cors_allow_origin(sender, request, **kwargs):
return request.path == "/o/userinfo/" or request.path == "/o/userinfo"


class IDPAppConfig(AppConfig):
name = "idp"
default = True

def ready(self):
check_request_enabled.connect(cors_allow_origin)
14 changes: 11 additions & 3 deletions tests/app/idp/idp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
https://docs.djangoproject.com/en/4.2/ref/settings/
"""

import os
from pathlib import Path


Expand All @@ -32,6 +33,7 @@
# Application definition

INSTALLED_APPS = [
"idp.apps.IDPAppConfig",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
Expand Down Expand Up @@ -186,10 +188,10 @@
"SCOPES": {
"openid": "OpenID Connect scope",
},
"ALLOWED_SCHEMES": ["https", "http"],
}

# just for this example
CORS_ORIGIN_ALLOW_ALL = True
# needs to be set to allow cors requests from the test app, along with ALLOWED_SCHEMES=["http"]
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"

LOGGING = {
"version": 1,
Expand All @@ -210,5 +212,11 @@
"level": "DEBUG",
"propagate": False,
},
# occasionally you may want to see what's going on in upstream in oauthlib
# "oauthlib": {
# "handlers": ["console"],
# "level": "DEBUG",
# "propagate": False,
# },
},
}