Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple configurations for AttributeResolver Shibboleth plugin #126

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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