From b5a29857752f5f2857baa33d3a7fe74df202697e Mon Sep 17 00:00:00 2001 From: Guillaume Rousse <guillaume.rousse@renater.fr> Date: Wed, 5 Dec 2018 15:51:01 +0100 Subject: [PATCH] make authentication optional --- lib/AccountManager/App.pm | 18 ++++++++++++------ templates/web/edugain/home.tt2.html | 2 +- templates/web/renater/home.tt2.html | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/AccountManager/App.pm b/lib/AccountManager/App.pm index 3d2ee7f..6ea6c2e 100644 --- a/lib/AccountManager/App.pm +++ b/lib/AccountManager/App.pm @@ -250,7 +250,8 @@ sub abort { sub req_select_federation { my ($self, %args) = @_; - $self->check_authentication(action => 'select_federation'); + $self->check_authentication(action => 'select_federation') + if $self->{configuration}->{app}->{login_url}; my $federations = $self->{configuration}->{federations}->{list}; my @federations = split(/, */, $federations); @@ -278,7 +279,8 @@ sub req_select_federation { sub req_select_sp { my ($self, %args) = @_; - $self->check_authentication(action => 'select_sp'); + $self->check_authentication(action => 'select_sp') + if $self->{configuration}->{app}->{login_url}; my $federation = $self->{cgi}->param('federation'); # not mandatory @@ -318,7 +320,8 @@ sub req_select_sp { sub req_select_email { my ($self, %args) = @_; - $self->check_authentication(action => 'select_email'); + $self->check_authentication(action => 'select_email') + if $self->{configuration}->{app}->{login_url}; my $entityid = $self->get_parameter(name => 'entityid'); my $federation = $self->{cgi}->param('federation'); # not mandatory @@ -402,7 +405,8 @@ sub req_select_email { sub req_complete_challenge { my ($self, %args) = @_; - $self->check_authentication(action => 'complete_challenge'); + $self->check_authentication(action => 'complete_challenge') + if $self->{configuration}->{app}->{login_url}; my $entityid = $self->get_parameter(name => 'entityid'); my $email = $self->get_parameter(name => 'email'); @@ -587,7 +591,8 @@ sub req_complete_challenge { sub req_create_accounts { my ($self, %args) = @_; - $self->check_authentication(action => 'create_accounts'); + $self->check_authentication(action => 'create_accounts') + if $self->{configuration}->{app}->{login_url}; my $entityid = $self->get_parameter(name => 'entityid'); my $token = $self->get_parameter(name => 'token'); @@ -691,7 +696,8 @@ sub req_create_accounts { sub req_download_accounts { my ($self) = @_; - $self->check_authentication(action => 'download_accounts'); + $self->check_authentication(action => 'download_accounts') + if $self->{configuration}->{app}->{login_url}; my $entityid = $self->get_parameter(name => 'entityid'); my $token = $self->get_parameter(name => 'token'); diff --git a/templates/web/edugain/home.tt2.html b/templates/web/edugain/home.tt2.html index c4b5d83..30d958e 100644 --- a/templates/web/edugain/home.tt2.html +++ b/templates/web/edugain/home.tt2.html @@ -9,6 +9,6 @@ <h2>[% lh.maketext("Get started") %]</h2> <p>[% lh.maketext("To start testing your own services, start by selecting one your are administrator for.") %]</p> -<p class="text-center"><a href="[% app.login_url %]?target=[% app.url %]%3Faction%3Dselect_federation" class="button">[% lh.maketext("Get started") %]</a></p> +<p class="text-center"><a href="[% IF app.login_url %][% app.login_url %]?target=[% app.url %]%3Faction%3Dselect_federation[% ELSE %][% app.url %]?action=select_federation[% END %]" class="button">[% lh.maketext("Get started") %]</a></p> [% END %] diff --git a/templates/web/renater/home.tt2.html b/templates/web/renater/home.tt2.html index dde4a7b..f701225 100644 --- a/templates/web/renater/home.tt2.html +++ b/templates/web/renater/home.tt2.html @@ -9,6 +9,6 @@ <h2>[% lh.maketext("Get started") %]</h2> <p>[% lh.maketext("To start testing your own services, start by selecting one your are administrator for.") %]</p> -<p class="text-center"><a href="[% app.login_url %]?target=[% app.url %]%3Faction%3Dselect_federation" class="button">[% lh.maketext("Get started") %]</a></p> +<p class="text-center"><a href="[% IF app.login_url %][% app.login_url %]?target=[% app.url %]%3Faction%3Dselect_federation[% ELSE %][% app.url %]?action=select_federation[% END %]" class="button">[% lh.maketext("Get started") %]</a></p> [% END %] -- GitLab