-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add FixedRedirectOnLogout plugin (v2.18.2-11)
- Loading branch information
Showing
5 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- a/usr/share/perl5/Lemonldap/NG/Portal/Main/Plugins.pm | ||
+++ b/usr/share/perl5/Lemonldap/NG/Portal/Main/Plugins.pm | ||
@@ -14,6 +14,7 @@ use Mouse; | ||
# Developers: 2FA must be loaded before Notifications | ||
# Developers: GlobalLogout must be the last loaded plugin | ||
our @pList = ( | ||
+ fixedLogoutRedirection => '::Plugins::FixedRedirectOnLogout', | ||
portalDisplayResetPassword => '::Plugins::MailPasswordReset', | ||
portalDisplayCertificateResetByMail => '::Plugins::CertificateResetByMail', | ||
portalStatus => '::Plugins::Status', | ||
--- /dev/null | ||
+++ b/usr/share/perl5/Lemonldap/NG/Portal/Plugins/FixedRedirectOnLogout.pm | ||
@@ -0,0 +1,34 @@ | ||
+package Lemonldap::NG::Portal::Plugins::FixedRedirectOnLogout; | ||
+ | ||
+use strict; | ||
+use Mouse; | ||
+use Lemonldap::NG::Portal::Main::Constants 'PE_OK'; | ||
+use URI; | ||
+ | ||
+our $VERSION = '2.20.0'; | ||
+ | ||
+extends 'Lemonldap::NG::Portal::Main::Plugin'; | ||
+ | ||
+use constant beforeLogout => 'run'; | ||
+ | ||
+sub init { | ||
+ my ($self) = @_; | ||
+ if ( $self->conf->{fixedLogoutRedirection} ) { | ||
+ my $host = URI->new($self->conf->{fixedLogoutRedirection})->host; | ||
+ $self->conf->{trustedDomains} .= " $host"; | ||
+ $self->conf->{trustedDomains} =~ s/^ //; | ||
+ } | ||
+ return 1; | ||
+} | ||
+ | ||
+sub run { | ||
+ my ( $self, $req ) = @_; | ||
+ if ( $self->conf->{fixedLogoutRedirection} ) { | ||
+ $req->logger->debug("Force logout redirection"); | ||
+ $req->mustRedirect(1); | ||
+ $req->urldc( $self->conf->{fixedLogoutRedirection} ); | ||
+ } | ||
+ return PE_OK; | ||
+} | ||
+ | ||
+1; |