Skip to content

Commit

Permalink
Support multiple configurations for AttributeResolver Shibboleth plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ioigoume committed Mar 10, 2022
1 parent 9d7c6ab commit 6d686e6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
17 changes: 16 additions & 1 deletion roles/shibboleth-sp/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,24 @@ shibboleth_sp_attribute_extractors:
reloadChanges: "false"
path: "attribute-map.xml"


# In order to create the Shibboleth configuration below:
# <AttributeResolver type="Query" subjectMatch="true"></AttributeResolver>
# <AttributeResolver type="Transform" source="eduPersonScopedAffiliation">
# <Regex match="^(.+)@(.+)" dest="eduPersonPrimaryAffiliation">$1</Regex>
# </AttributeResolver>
#
# the yaml structure should be the following:
shibboleth_sp_attribute_resolvers:
- type: "Query"
subject_match: "true"
subjectMatch: "true"
# - type: "Transform"
# source: "eduPersonScopedAffiliation"
# regex:
# - value: "$1"
# properties:
# match: "^(.+)@(.+)"
# dest: "eduPersonPrimaryAffiliation"

# The default settings can be overridden by creating ApplicationOverride
# elements. When you use virtual hosting, there is no special handler
Expand Down
20 changes: 15 additions & 5 deletions roles/shibboleth-sp/templates/shibboleth2.xml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,21 @@
{% endfor %}

{% for resolver in shibboleth_sp_attribute_resolvers %}
<AttributeResolver type="{{ resolver.type }}"
{% if resolver.subject_match is defined %}
subjectMatch="{{ resolver.subject_match }}"
{% endif %}
/>
<AttributeResolver
{%- for key, value in resolver.items() -%}
{% if "regex" not in key %}
{{ key }}="{{ value }}"
{%- endif -%}
{%- endfor %}>
{% if resolver.regex is defined %}
{% for regex_properties in resolver.regex -%}
<Regex
{%- for key, value in regex_properties.properties.items() %}
{{ key }}="{{ value }}"
{%- endfor %}>{{ regex_properties.value | default('') }}</Regex>
{% endfor %}
{%- endif -%}
</AttributeResolver>
{% endfor %}

<!-- Default filtering policy for recognized attributes, lets other data pass. -->
Expand Down

0 comments on commit 6d686e6

Please sign in to comment.