Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
peppelinux committed Jul 17, 2021
2 parents ad53ea3 + b2cc016 commit b5f6963
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 36 deletions.
4 changes: 2 additions & 2 deletions docker-compose.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DOCKER_COMPOSE_DEFAULT_NETWORK_GATEWAY_FQDN=hostnet
SPID_BASE_SCHEMA_HOST_PORT=http://hostnet:8000

SPID_SAML_CHECK_REMOTE_METADATA_ACTIVE=True
SPID_SAML_CHECK_METADATA_URL=http://hostnet:8080/metadata.xml
SPID_SAML_CHECK_METADATA_URL=https://hostnet:8080/metadata.xml

SPID_SAML_CHECK_DEMO_REMOTE_METADATA_ACTIVE=True
SPID_SAML_CHECK_DEMO_METADATA_URL=http://hostnet:8080/idp/metadata.xml
SPID_SAML_CHECK_DEMO_METADATA_URL=https://hostnet:8080/idp/metadata.xml
4 changes: 2 additions & 2 deletions example/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ else
--https 0.0.0.0:8000,./certificates/public.cert,./certificates/private.key \
--module example.wsgi:application \
--env example.settings \
--chdir .

--chdir . \
# --honour-stdin
fi
23 changes: 0 additions & 23 deletions example/spid_config/metadata/spid-saml-check.xml

This file was deleted.

12 changes: 10 additions & 2 deletions example/spid_config/spid_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@
SPID_IDENTITY_PROVIDERS_METADATA_DIR = os.path.join(BASE_DIR, 'spid_config/metadata/')

SPID_SAML_CHECK_IDP_ACTIVE = os.environ.get('SPID_SAML_CHECK_IDP_ACTIVE', 'False') == 'True'
SPID_SAML_CHECK_METADATA_URL = os.environ.get('SPID_SAML_CHECK_METADATA_URL', 'http://localhost:8080/metadata.xml')
SPID_SAML_CHECK_METADATA_URL = os.environ.get('SPID_SAML_CHECK_METADATA_URL', 'https://localhost:8080/metadata.xml')

SPID_DEMO_IDP_ACTIVE = os.environ.get('SPID_DEMO_IDP_ACTIVE', 'False') == 'True'
SPID_DEMO_METADATA_URL = os.environ.get('SPID_DEMO_METADATA_URL', 'http://localhost:8080/demo/metadata.xml')
SPID_DEMO_METADATA_URL = os.environ.get('SPID_DEMO_METADATA_URL', 'https://localhost:8080/demo/metadata.xml')

SPID_VALIDATOR_IDP_ACTIVE = os.environ.get('SPID_VALIDATOR_IDP_ACTIVE', 'False') == 'True'
SPID_VALIDATOR_METADATA_URL = os.environ.get('SPID_VALIDATOR_METADATA_URL', "https://validator.spid.gov.it/metadata.xml")


# Avviso 29v3
SPID_PREFIXES = dict(
Expand Down Expand Up @@ -81,6 +85,8 @@
# Configuration for pysaml2 as managed by djangosaml2. For SPID SP service the most
# part is built dynamically from provided SPID_* settings and from SPID_* defaults.
SAML_CONFIG = {

"entityid": 'ssdasdasd',
# Required organization info, you can set multi-language information here.
'organization': {
'name': [('Example', 'it'), ('Example', 'en')],
Expand All @@ -92,6 +98,8 @@
'debug': True,
'xmlsec_binary': get_xmlsec_binary(['/opt/local/bin', '/usr/bin/xmlsec1']),

"disable_ssl_certificate_validation": True,

# The other entries are dynamically generated from SPID_* provided settings
# and defaults. You can still provide those entries here but they can useful
# only for other SAML2 service in your installation, not for SPID.
Expand Down
7 changes: 4 additions & 3 deletions src/djangosaml2_spid/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
settings,
"SPID_SAML_CHECK_METADATA_URL",
os.environ.get(
"SPID_SAML_CHECK_METADATA_URL", "http://localhost:8080/metadata.xml"
"SPID_SAML_CHECK_METADATA_URL", "https://localhost:8080/metadata.xml"
),
)

Expand All @@ -147,10 +147,10 @@
os.environ.get("SPID_DEMO_METADATA_URL", "https://demo.spid.gov.it/metadata.xml"),
)

settings.SPID_VALIDATOR_IDP_ACTIVE = getattr(settings, "SPID_VALIDATOR_ACTIVE", False)
settings.SPID_VALIDATOR_IDP_ACTIVE = getattr(settings, "SPID_VALIDATOR_IDP_ACTIVE", False)

settings.SPID_VALIDATOR_METADATA_URL = getattr(
settings, "SPID_VALIDATOR_METADATA_URL", "https://validator.spid.gov.it"
settings, "SPID_VALIDATOR_METADATA_URL", "https://validator.spid.gov.it/metadata.xml"
)

# Avviso 29v3
Expand Down Expand Up @@ -302,6 +302,7 @@ def config_settings_loader(request: Optional[HttpRequest] = None) -> SPConfig:
"allow_unknown_attributes": True,
},
},
"disable_ssl_certificate_validation": settings.SAML_CONFIG.get("disable_ssl_certificate_validation"),
"metadata": {
"local": [settings.SPID_IDENTITY_PROVIDERS_METADATA_DIR],
"remote": [],
Expand Down
11 changes: 8 additions & 3 deletions src/djangosaml2_spid/templates/spid_button.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@
<div id="spid-idp-button-{{ size|spid_button_size }}-post" class="spid-idp-button spid-idp-button-tip spid-idp-button-relative">
<ul id="spid-idp-list-medium-root-get" class="spid-idp-button-menu" aria-labelledby="spid-idp">

{% if spid_saml_check_idp_active %}
{% spid_saml_check_idp_active as spid_saml_check %}
{% if spid_saml_check %}
<li class="spid-idp-button-link" id="spid_saml_check" data-idp="spid_saml_check" data-entityid="{% spid_saml_check_url %}">
<a href="#"><span class="spid-sr-only">SPID-saml-check</span><img src="" onerror="this.src=''; this.onerror=null;" alt="Spid saml check"></a>
</li>
{% endif %}
{% if spid_demo_idp_active %}

{% spid_demo_idp_active as spid_demo_idp %}
{% if spid_demo_idp %}
<li class="spid-idp-button-link" id="spid_demo" data-idp="spid_demo" data-entityid="{% spid_demo_url %}">
<a href="#"><span class="spid-sr-only">SPID-saml-check Demo IdP</span><img src="" onerror="this.src=''; this.onerror=null;" alt="Spid saml check demo IdP"></a>
</li>
{% endif %}
{% if spid_validator_idp_active %}

{% spid_validator_idp_active as spid_validator %}
{% if spid_validator %}
<li class="spid-idp-button-link" id="spid_validator" data-idp="spid_validator" data-entityid="{% spid_validator_url %}">
<a href="#"><span class="spid-sr-only">SPID-Validator</span><img src="" onerror="this.src=''; this.onerror=null;" alt="Spid Validator"></a>
</li>
Expand Down
3 changes: 2 additions & 1 deletion src/djangosaml2_spid/templates/wayf.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% extends 'spid_base.html' %}
{% load spid static %}
{% load static %}
{% load spid %}

{% block page_title %}
<title>
Expand Down

0 comments on commit b5f6963

Please sign in to comment.