From c42c446a56c25c29fe56e1bf296306ddb1bd1795 Mon Sep 17 00:00:00 2001 From: Johan Wassberg Date: Wed, 20 Dec 2023 12:42:16 +0100 Subject: [PATCH] Use a selected backend in metadata If multiple backends are available we want to be able to specify one when creating the metadata with `satosa_saml_metadata`. Otherwise all available backend appears in `SingleSignOnService` for the frontend. --- src/satosa/metadata_creation/saml_metadata.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/satosa/metadata_creation/saml_metadata.py b/src/satosa/metadata_creation/saml_metadata.py index f88bbaaec..a39c95ab6 100644 --- a/src/satosa/metadata_creation/saml_metadata.py +++ b/src/satosa/metadata_creation/saml_metadata.py @@ -86,8 +86,11 @@ def _create_frontend_metadata(frontend_modules, backend_modules): frontend_metadata[frontend.name].append(entity_desc) elif isinstance(frontend, SAMLFrontend): - frontend.register_endpoints([backend.name for - backend in backend_modules]) + if "preferred_backend_in_metadata" in frontend.config["idp_config"]: + frontend.register_endpoints([frontend.config["idp_config"]["preferred_backend_in_metadata"]]) + else: + frontend.register_endpoints([backend.name for + backend in backend_modules]) entity_desc = _create_entity_descriptor(frontend.idp_config) frontend_metadata[frontend.name].append(entity_desc)