Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saml2 #299

Merged
merged 4 commits into from
Sep 4, 2024
Merged

Saml2 #299

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
4 changes: 2 additions & 2 deletions backend/core/saml2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
16 changes: 12 additions & 4 deletions backend/pzserver/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
Loading