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 9, 2022
1 parent 9d7c6ab commit 8e7e13c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
9 changes: 8 additions & 1 deletion roles/shibboleth-sp/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,14 @@ shibboleth_sp_attribute_extractors:

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 8e7e13c

Please sign in to comment.