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

New configuration parameter to use a hard-coded set of SP contacts.

Paramater: dev_sp_contact


git-svn-id: https://svn.geant.net/GEANT/edugain_testidp_account_manager/trunk@24 047e039d-479c-447e-8a29-aa6bf4a09bab
parent 3d3b9da0
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,9 @@ use IdPAccountManager::ServiceProvider;
use IdPAccountManager::AuthenticationToken;
my %options;
unless (&GetOptions(\%options, 'help', 'add_test_account', 'account_profile=s', 'sp_entityid=s', 'list_test_accounts', 'parse_federation_metadata', 'list_service_providers','list_authentication_tokens', 'get_authentication_token', 'add_authentication_token','email_address=s','token=s')) {
unless (&GetOptions(\%options, 'help', 'add_test_account', 'account_profile=s', 'sp_entityid=s', 'list_test_accounts', 'parse_federation_metadata',
'list_service_providers','list_authentication_tokens', 'get_authentication_token', 'add_authentication_token','email_address=s',
'token=s','send_notice')) {
die "Unknown options.";
}
......@@ -175,6 +177,19 @@ if ($options{'add_test_account'}) {
$authentication_token->print();
}elsif ($options{'send_notice'}) {
unless ($options{'email_address'}) {
die "Missing email_address option";
}
unless (&IdPAccountManager::Tools::mail_notice('template' => 'templates/mail/notification_generic_error.tt2.eml',
'data' => {},
'to' => $options{'email_address'})) {
die "Failed to send mail notice to $options{'email_address'}\n";
}
printf "Mail notice sent to $options{'email_address'}\n";
}else {
die "Missing arguments";
......
......@@ -174,10 +174,23 @@ sub mail_notice {
$mail_data->{'to'} = $notice_email;
## Protection to prevent notifications during test dev phases
## Notify only admin_email
if ($Conf::global{'no_mail_outside'}) {
&do_log('info',"no_mail_outside option set; notification for %s rerouted to admins ; ", $notice_email);
$notice_email = $Conf::global{'admin_email'};
## Notify only admin_email or dev_sp_contact addresses
if ($Conf::global{'dev_no_mail_outside'}) {
my %rcpt = map {$_ => 1} split(/,/, $notice_email);
my %authorized_rcpt = map {$_ => 1} split(/,/, join(',', $Conf::global{'admin_email'}, $Conf::global{'dev_sp_contact'}));
my $change_rcpt = 0;
foreach my $email (keys %rcpt) {
unless ($authorized_rcpt{$email}) {
$change_rcpt = 1;
last
}
}
if ($change_rcpt) {
&do_log('info',"no_mail_outside option set; notification for %s rerouted to admins ; ", $notice_email);
$notice_email = $Conf::global{'admin_email'};
}
}
&do_log('trace', '(template=%s, to=%s)', $in{'template'}, $mail_data->{'to'});
......
......@@ -14,10 +14,17 @@ Before you can create test accounts at this Identity Provider, we need to ensure
<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>
[% FOREACH contact IN sp_metadata_as_hashref.contacts -%]
[% matches = contact.EmailAddress.match('^(mailto:)?(.*)$') %]
[% SET email = matches.1%]
[% matches = contact.EmailAddress.match('^(mailto:)?(.*)$') %]
[% contacts.${matches.1} = 1 %]
[% END %]
[% FOREACH email IN conf.dev_sp_contact.split(',') %]
[% contacts.${email} = 1 %]
[% END %]
[% FOREACH email IN contacts.keys.sort %]
<input name="email_address" value="[% email %]" id="email_address" type="radio" class="required"/>
<label for="email_address">[% email %]</label>
......
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