Skip to content

Commit 65226ca

Browse files
committed
Add assurance_certification configuration option
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent 4815d51 commit 65226ca

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

docs/howto/config.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@ Configuration directives
5555
General directives
5656
------------------
5757

58+
assurance_certification
59+
^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
Format::
62+
63+
"assurance_specification": [
64+
"https://refeds.org/sirtfi",
65+
]
66+
67+
Generates an `Attribute` element with name-format
68+
`urn:oasis:names:tc:SAML:2.0:attrname-format:uri` and name
69+
`urn:oasis:names:tc:SAML:attribute:assurance-certification` that contains
70+
`AttributeValue` elements with the given values from the list.
71+
The element is added under the generated metadata `EntityDescriptor` as an
72+
`Extension` element under the `EntityAttributes` element.
73+
74+
Read more about `representing assurance information at the specification <https://wiki.oasis-open.org/security/SAML2IDAssuranceProfile>`_.
75+
5876
attribute_map_dir
5977
^^^^^^^^^^^^^^^^^
6078

@@ -666,7 +684,7 @@ Where the endpoints for the services provided are.
666684
This directive has as value a dictionary with one or more of the following keys:
667685

668686
* artifact_resolution_service (aa, idp and sp)
669-
* `assertion_consumer_service <https://wiki.shibboleth.net/confluence/display/CONCEPT/AssertionConsumerService>`_ (sp)
687+
* `assertion_consumer_service <https://wiki.shibboleth.net/confluence/display/CONCEPT/AssertionConsumerService>`_ (sp)
670688
* assertion_id_request_service (aa, idp)
671689
* attribute_service (aa)
672690
* manage_name_id_service (aa, idp)

src/saml2/config.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"disable_ssl_certificate_validation",
5353
"preferred_binding",
5454
"session_storage",
55+
"assurance_certification",
5556
"entity_category",
5657
"xmlsec_path",
5758
"extension_schemas",
@@ -221,7 +222,8 @@ def __init__(self, homedir="."):
221222
self.preferred_binding = PREFERRED_BINDING
222223
self.domain = ""
223224
self.name_qualifier = ""
224-
self.entity_category = ""
225+
self.assurance_certification = []
226+
self.entity_category = []
225227
self.crypto_backend = 'xmlsec1'
226228
self.id_attr_name = None
227229
self.scope = ""
@@ -568,11 +570,11 @@ def config_factory(_type, config):
568570
"""
569571
570572
:type _type: str
571-
:param _type:
572-
573+
:param _type:
574+
573575
:type config: str or dict
574576
:param config: Name of file with pysaml2 config or CONFIG dict
575-
577+
576578
:return:
577579
"""
578580
if _type == "sp":

src/saml2/metadata.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,17 @@ def entity_descriptor(confd):
692692
if confd.contact_person is not None:
693693
entd.contact_person = do_contact_persons_info(confd.contact_person)
694694

695+
if confd.assurance_certification:
696+
if not entd.extensions:
697+
entd.extensions = md.Extensions()
698+
ava = [AttributeValue(text=c) for c in confd.assurance_certification]
699+
attr = Attribute(
700+
attribute_value=ava,
701+
name="urn:oasis:names:tc:SAML:attribute:assurance-certification"
702+
)
703+
item = mdattr.EntityAttributes(attribute=attr)
704+
entd.extensions.add_extension_element(item)
705+
695706
if confd.entity_category:
696707
if not entd.extensions:
697708
entd.extensions = md.Extensions()

0 commit comments

Comments
 (0)