Skip to content
Snippets Groups Projects
Commit 2fb08fe8 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

allows usage of labels for federations

parent 1c0d6edb
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,7 @@ use AccountManager::App;
my $configuration_file =
$ENV{ACCOUNTMANAGER_CONFIG} || '@confdir@/manager.conf';
my $configuration = Config::Tiny->read($configuration_file);
my $configuration = Config::Tiny->read($configuration_file, 'utf8');
if (!$configuration) {
die Config::Tiny->errstr() . "\n";
}
......
......@@ -9,6 +9,11 @@ templates_dir = @templatesdir@
# templates theme
templates_theme = edugain
accounts_file = /var/lib/access-check/accounts.php
federations = edugain
[edugain]
metadata = /var/lib/access-check/edugain.xml
label = eduGAIN
[logger]
file = /var/log/access-check/manager.log
......@@ -26,9 +31,6 @@ username = idpadmin
password = secret
options = mysql_enable_utf8
[federations]
edugain = /var/lib/access-check/edugain.xml
[idp]
scope = my.fqdn
entityid = https://my.fqdn/simplesaml/saml2/idp/metadata.php
......
......@@ -114,7 +114,7 @@ sub new {
);
}
if (!$self->{configuration}->{federations}) {
if (!$self->{configuration}->{setup}->{federations}) {
$self->{logger}->fatal(
"No federations defined in configuration, aborting"
);
......@@ -250,7 +250,8 @@ sub abort {
sub req_start {
my ($self, %args) = @_;
my @federations = keys %{$self->{configuration}->{federations}};
my $federations = $self->{configuration}->{setup}->{federations};
my @federations = split(/, */, $federations);
if (@federations == 1) {
$self->req_select_sp(federation => $federations[0]);
} else {
......@@ -262,13 +263,15 @@ sub req_start {
sub req_select_federation {
my ($self, %args) = @_;
my @federations = keys %{$self->{configuration}->{federations}};
my $federations = $self->{configuration}->{setup}->{federations};
my @federations = split(/, */, $federations);
my %federations = map { $_ => $self->{configuration}->{$_}->{label} } @federations;
$self->respond(
template => 'select_federation.tt2.html',
data => {
action => 'select_federation',
federations => \@federations
federations => \%federations
}
);
}
......@@ -751,7 +754,7 @@ sub get_metadata_file {
my $federation = $args{federation};
my $file = $self->{configuration}->{federations}->{$federation};
my $file = $self->{configuration}->{$federation}->{metadata};
$self->abort(
log => "Incorrect parameter: federation",
......
......@@ -14,9 +14,9 @@
<fieldset>
<legend>[% lh.maketext("Select the federation corresponding to the service you want to test:") %]</legend>
[% FOREACH federation IN federations.sort %]
<input id="[% federation %]" name="federation" value="[% federation %]" type="radio" class="required"/>
<label for="[% federation %]">[% federation %]</label>
[% FOREACH key IN federations.keys.sort %]
<input id="[% key %]" name="federation" value="[% key %]" type="radio" class="required"/>
<label for="[% key %]">[% federations.$key %]</label>
<br/>
[% END %]
<label for="federation" class="error"></label>
......
......@@ -14,9 +14,9 @@
<fieldset>
<legend>[% lh.maketext("Select the federation corresponding to the service you want to test:") %]</legend>
[% FOREACH federation IN federations.sort %]
<input id="[% federation %]" name="federation" value="[% federation %]" type="radio" class="required"/>
<label for="[% federation %]">[% federation %]</label>
[% FOREACH key IN federations.keys.sort %]
<input id="[% key %]" name="federation" value="[% key %]" type="radio" class="required"/>
<label for="[% key %]">[% federations.$key %]</label>
<br/>
[% END %]
<label for="federation" class="error"></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