File tree Expand file tree Collapse file tree
.github/workflows/scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,6 +79,11 @@ services:
7979 image: "docker.io/pulp/pulp-fixtures:latest"
8080 env:
8181 BASE_URL: "http://pulp-fixtures:8080"
82+ - name: "saml2-idp"
83+ image: "ghcr.io/pfrest/mock-saml2-idp:latest"
84+ env:
85+ SP_ENTITY_ID: "http://pulp"
86+ SP_ACS_LOCATION: "http://pulp/saml/acs/"
8287VARSYAML
8388
8489if [ " $TEST " = " s3" ]; then
Original file line number Diff line number Diff line change 1-
1+ pulpcore[saml2]
Original file line number Diff line number Diff line change @@ -594,6 +594,21 @@ def otel_middleware_hook(settings):
594594 return data
595595
596596
597+ def saml2_settings_hook (settings ):
598+ data = {"dynaconf_merge" : True }
599+ if "LOGIN_URL" not in settings :
600+ data ["LOGIN_URL" ] = "/saml2/login/"
601+ if "SESSION_COOKIE_SECURE" not in settings :
602+ data ["SESSION_COOKIE_SECURE" ] = True
603+ if "SESSION_EXPIRE_AT_BROWSER_CLOSE" not in settings :
604+ data ["SESSION_EXPIRE_AT_BROWSER_CLOSE" ] = True
605+ if "SAML_CONFIG" in settings :
606+ data ["INSTALLED_APPS" ] = ["djangosaml2" ]
607+ data ["MIDDLEWARE" ] = ["djangosaml2.middleware.SamlSessionMiddleware" ]
608+ data ["AUTHENTICATION_BACKENDS" ] = ["djangosaml2.backends.Saml2Backend" ]
609+ return data
610+
611+
597612del preload_settings
598613
599614settings = DjangoDynaconf (
@@ -618,7 +633,7 @@ def otel_middleware_hook(settings):
618633 otel_metrics_dispatch_interval_validator ,
619634 distributed_publication_retention_period_validator ,
620635 ],
621- post_hooks = (otel_middleware_hook ,),
636+ post_hooks = (otel_middleware_hook , saml2_settings_hook ),
622637)
623638
624639_logger = getLogger (__name__ )
Original file line number Diff line number Diff line change @@ -245,6 +245,9 @@ class NoSchema(p.callback.cls):
245245 path ("" , include ("social_django.urls" , namespace = settings .SOCIAL_AUTH_URL_NAMESPACE ))
246246 )
247247
248+ if "djangosaml2" in settings .INSTALLED_APPS :
249+ urlpatterns .append (path ("saml2/" , include ("djangosaml2.urls" )))
250+
248251#: The Pulp Platform v3 API router, which can be used to manually register ViewSets with the API.
249252root_router = PulpDefaultRouter ()
250253
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ s3 = ["django-storages[boto3]==1.14.6"]
7373google = [" django-storages[google]==1.14.6" ]
7474azure = [" django-storages[azure]==1.14.6" ]
7575prometheus = [" django-prometheus" ]
76+ saml2 = [" djangosaml2>=1.12.0,<1.13" ]
7677kafka = [
7778 # Pinned because project warns "things might (and will) break with every update"
7879 " cloudevents==1.11.0" ,
You can’t perform that action at this time.
0 commit comments