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