Skip to content

Commit 1c52d2e

Browse files
author
Ioannis Kakavas
committed
Addressing @c00kiemon5ter's comments
1 parent 6e8bf88 commit 1c52d2e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

example/plugins/backends/saml2_backend.yaml.example

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module: satosa.backends.saml2.SAMLBackend
22
name: Saml2
33
config:
4+
idp_blacklist_file: /path/to/blacklist.json
45
sp_config:
56
key_file: backend.key
67
cert_file: backend.crt
@@ -13,8 +14,6 @@ config:
1314
local: [idp.xml]
1415

1516
entityid: <base_url>/<name>/proxy_saml2_backend.xml
16-
idp_blacklist_enabled: true
17-
idp_blacklist_file: /path/to/blacklist.json
1817
service:
1918
sp:
2019
want_response_signed: true

src/satosa/backends/saml2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def __init__(self, outgoing, internal_attributes, config, base_url, name):
6363
self.discosrv = config.get(self.KEY_DISCO_SRV)
6464
self.encryption_keys = []
6565
self.outstanding_queries = {}
66+
self.idp_blacklist_file = config.get('idp_blacklist_file', None)
6667

6768
sp_keypairs = sp_config.getattr('encryption_keypairs', '')
6869
sp_key_file = sp_config.getattr('key_file', '')
@@ -152,8 +153,8 @@ def authn_request(self, context, entity_id):
152153

153154
# If IDP blacklisting is enabled and the selected IDP is blacklisted,
154155
# stop here
155-
if self.config["sp_config"].get("idp_blacklist_enabled", None):
156-
with open(self.config["sp_config"]["idp_blacklist_file"]) as blacklist_file:
156+
if self.idp_blacklist_file:
157+
with open(self.idp_blacklist_file) as blacklist_file:
157158
blacklist_array = json.load(blacklist_file)['blacklist']
158159
if entity_id in blacklist_array:
159160
satosa_logging(logger, logging.DEBUG, "IdP with EntityID {} is blacklisted".format(entity_id), context.state, exc_info=False)

0 commit comments

Comments
 (0)