diff --git a/backend/core/saml2.py b/backend/core/saml2.py index c1998b0..9257e22 100644 --- a/backend/core/saml2.py +++ b/backend/core/saml2.py @@ -10,8 +10,8 @@ def _update_user(self, user, attributes: dict, attribute_mapping: dict, force_sa log = logging.getLogger("saml") - log.debug("USER: ", user) - log.debug("ATTRIBUTES: ", attributes) + log.debug("USER: %s", user) + log.debug("ATTRIBUTES: %s", attributes) display_name = attributes.get('cn', [""])[0] diff --git a/backend/pzserver/settings.py b/backend/pzserver/settings.py index ecc2516..c13b68f 100644 --- a/backend/pzserver/settings.py +++ b/backend/pzserver/settings.py @@ -13,7 +13,8 @@ import os import saml2 -import saml2.saml + +# import saml2.saml # Build paths inside the project like this: BASE_DIR / 'subdir'. # BASE_DIR = Path(__file__).resolve().parent.parent @@ -29,7 +30,7 @@ SECRET_KEY = os.getenv("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = int(os.getenv("DEBUG", 1)) +DEBUG = int(os.getenv("DEBUG", "1")) # Application definition @@ -364,6 +365,12 @@ "email": ("email",), } + METADATAS = str(os.getenv("IDP_METADATA")).split(",") + METADATA_URLS = [] + + for metadata in METADATAS: + METADATA_URLS.append({"url": metadata, "cert": None}) + SAML_CONFIG = { # Biblioteca usada para assinatura e criptografia "xmlsec_binary": "/usr/bin/xmlsec1", @@ -411,9 +418,10 @@ }, # Indica onde os metadados podem ser encontrados "metadata": { - "local": [os.getenv("IDP_METADATA")], + "remote": METADATA_URLS, + # "local": [os.getenv("IDP_METADATA")], }, - "debug": os.getenv("DEBUG", 1), + "debug": os.getenv("DEBUG", "1"), # Signature "key_file": SIG_KEY_PEM, # private part "cert_file": SIG_CERT_PEM, # public part