Skip to content
This repository was archived by the owner on Jan 10, 2019. It is now read-only.

Commit bb8689b

Browse files
committed
Add entityID as attribute for IdP Metadata Store
Added capability to assert the entityID of the authenticating IdP as an attribute.
1 parent d26f4b0 commit bb8689b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

example/plugins/microservices/idp_metadata_attribute_store.yaml.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ config:
88
# Language preference. 'en' or English is the default
99
# if not specified.
1010
lang: en
11+
entity_id:
12+
internal_attribute_name: idpentityid
1113
organization_name:
1214
internal_attribute_name: idporgname
1315
organization_display_name:

src/satosa/micro_services/idp_metadata_attribute_store.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
internal_attribute_name: idpdisplayname
2222
# Language preference with 'en' or English as default
2323
lang: en
24+
entity_id:
25+
internal_attribute_name: idpentityid
2426
organization_name:
2527
internal_attribute_name: idporgname
2628
lang: en
@@ -45,6 +47,7 @@
4547
import satosa.micro_services.base
4648
from satosa.logging_util import satosa_logging
4749
from satosa.exception import SATOSAError
50+
from satosa.context import Context
4851

4952
import copy
5053
import logging
@@ -159,15 +162,22 @@ def process(self, context, data):
159162

160163
satosa_logging(logger, logging.DEBUG, "Using config {}".format(config), context.state)
161164

165+
# Log the entityID of the authenticating IdP.
166+
satosa_logging(logger, logging.INFO, "entityID for authenticating IdP is {}".format(idp_entity_id), context.state)
167+
162168
# Ignore this IdP if so configured.
163169
if config['ignore']:
164170
satosa_logging(logger, logging.INFO, "Ignoring IdP {}".format(idp_entity_id), context.state)
165171
return super().process(context, data)
166172

173+
# Set the entityID attribute if so configured.
174+
if 'entity_id' in config:
175+
data.attributes[config['entity_id']['internal_attribute_name']] = idp_entity_id
176+
167177
# Get the metadata store the SP for the proxy is using. This
168178
# will be an instance of the class MetadataStore from mdstore.py
169179
# in pysaml2.
170-
metadata_store = context.internal_data['metadata_store']
180+
metadata_store = context.get_decoration(Context.KEY_BACKEND_METADATA_STORE)
171181

172182
# Get the metadata for the IdP.
173183
try:

0 commit comments

Comments
 (0)