Skip to content
Snippets Groups Projects
Commit 0ea81de7 authored by renater.salaun's avatar renater.salaun
Browse files

Bug fix to get email addresses regardless of XML namespaces

git-svn-id: https://svn.geant.net/GEANT/edugain_testidp_account_manager/trunk@11 047e039d-479c-447e-8a29-aa6bf4a09bab
parent d1d77343
No related branches found
No related tags found
No related merge requests found
...@@ -234,10 +234,12 @@ sub _parse_saml_metadata { ...@@ -234,10 +234,12 @@ sub _parse_saml_metadata {
}elsif ($child->nodeName =~ /ContactPerson$/) { }elsif ($child->nodeName =~ /ContactPerson$/) {
my %contact_details; my %contact_details;
$contact_details{'type'} = $child->getAttribute('contactType'); $contact_details{'type'} = $child->getAttribute('contactType');
foreach my $contact_child ($child->childNodes()) { if (defined $contact_details{'type'}) {
$contact_details{$contact_child->nodeName} = &IdPAccountManager::Tools::encode_utf8($contact_child->textContent()); foreach my $contact_child ($child->childNodes()) {
} $contact_details{$contact_child->localName} = &IdPAccountManager::Tools::encode_utf8($contact_child->textContent());
push @{$extracted_data->{'contacts'}}, \%contact_details; }
push @{$extracted_data->{'contacts'}}, \%contact_details;
}
} }
...@@ -257,8 +259,8 @@ sub _parse_saml_metadata { ...@@ -257,8 +259,8 @@ sub _parse_saml_metadata {
my %contact_details; my %contact_details;
$contact_details{'type'} = $contact->getAttribute('contactType'); $contact_details{'type'} = $contact->getAttribute('contactType');
foreach my $contact_child ($EntityDescriptor->childNodes()) { foreach my $contact_child ($EntityDescriptor->childNodes()) {
&IdPAccountManager::Tools::do_log('trace', "Contact : %s", $contact_child->nodeName); &IdPAccountManager::Tools::do_log('trace', "Contact : %s", $contact_child->localName);
$contact_details{$contact_child->nodeName} = &IdPAccountManager::Tools::encode_utf8($contact_child->textContent()); $contact_details{$contact_child->localName} = &IdPAccountManager::Tools::encode_utf8($contact_child->textContent());
} }
push @{$extracted_data->{'contacts'}}, \%contact_details; push @{$extracted_data->{'contacts'}}, \%contact_details;
} }
......
<h3>Send email challenge</h3> <h3>Send email challenge</h3>
[% IF entity.display_name && entity.display_name.en %] [% IF sp_metadata_as_hashref.display_name && sp_metadata_as_hashref.display_name.en %]
[% SET sp_display_name = sp_metadata_as_hashref.display_name.en %] [% SET sp_display_name = sp_metadata_as_hashref.display_name.en %]
[% ELSE %] [% ELSE %]
[% SET sp_display_name = sp_metadata_as_hashref.entityid %] [% SET sp_display_name = sp_metadata_as_hashref.entityid %]
...@@ -11,17 +11,16 @@ Before you can create test accounts at this Identity Provider, we need to ensure ...@@ -11,17 +11,16 @@ Before you can create test accounts at this Identity Provider, we need to ensure
<fieldset> <fieldset>
[% IF sp_metadata_as_hashref.contacts.defined %] [% IF sp_metadata_as_hashref.contacts.defined %]
<legend>Select your email address</legend> <legend>Select your email address</legend>
<label for="sp_entityid">The email addresses below have been extracted from your SP SAML metadata.<br/>Please select the email address where an email challenge can be sent to validate your identity</label> <label for="sp_entityid">The email addresses below have been extracted from your SP SAML metadata.<br/>Please select the email address where an email challenge
can be sent to validate your identity</label>
<ul>
[% FOREACH contact IN sp_metadata_as_hashref.contacts -%] [% FOREACH contact IN sp_metadata_as_hashref.contacts -%]
[% matches = contact.EmailAddress.match('^(mailto:)?(.*)$') %] [% matches = contact.EmailAddress.match('^(mailto:)?(.*)$') %]
[% SET email = matches.1%] [% SET email = matches.1%]
<li><input name="email" value="[% email %]" id="[% email %]" type="radio"/> <input name="email" value="[% email %]" id="[% email %]" type="radio"/>
<label for="[% email %]">[% email %]</label></li> <label for="[% email %]">[% email %]</label>
[% END %] [% END %]
</ul>
[% ELSE %] [% ELSE %]
No ContactPerson elements could be found in your SP SAML metadata. Therefore we are unable to provide test accounts for your SP. Please contact your local federation No ContactPerson elements could be found in your SP SAML metadata. Therefore we are unable to provide test accounts for your SP. Please contact your local federation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment