From 1c5d4d8c32e84eae5b6b8d00215194485857981b Mon Sep 17 00:00:00 2001 From: David COUTADEUR Date: Thu, 20 Mar 2014 18:40:26 +0000 Subject: [PATCH] - correcting old style specific handlers (reinjecting modification from SpecificHandlers/*.pm) - adding a comment line to indicate which style is the current specific handler and how it is supposed to be launched - adapting DefaultHandler.pm to permit tests passing configuration file parameter (references #630) --- .../lib/Lemonldap/NG/Handler/AuthBasic.pm | 4 ++++ .../lib/Lemonldap/NG/Handler/DefaultHandler.pm | 6 +++++- .../lib/Lemonldap/NG/Handler/SecureToken.pm | 13 +++++++++++++ .../NG/Handler/SpecificHandlers/AuthBasic.pm | 3 +++ .../NG/Handler/SpecificHandlers/SecureToken.pm | 3 +++ .../NG/Handler/SpecificHandlers/SympaAutoLogin.pm | 3 +++ .../NG/Handler/SpecificHandlers/UpdateCookie.pm | 3 +++ .../NG/Handler/SpecificHandlers/ZimbraPreAuth.pm | 3 +++ .../lib/Lemonldap/NG/Handler/SympaAutoLogin.pm | 13 +++++++++++++ .../lib/Lemonldap/NG/Handler/UpdateCookie.pm | 4 ++++ .../lib/Lemonldap/NG/Handler/ZimbraPreAuth.pm | 13 +++++++++++++ 11 files changed, 67 insertions(+), 1 deletion(-) diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/AuthBasic.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/AuthBasic.pm index 2966febb2..6a29f6260 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/AuthBasic.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/AuthBasic.pm @@ -3,6 +3,10 @@ ##@class # Auth-basic authentication with Lemonldap::NG rights management + +# This specific handler is intended to be called by a handler caller +# old working, kept for compatibility with previous 1.4.0 versions + package Lemonldap::NG::Handler::AuthBasic; use strict; diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/DefaultHandler.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/DefaultHandler.pm index b4a98e3e4..829e3a3f7 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/DefaultHandler.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/DefaultHandler.pm @@ -41,6 +41,10 @@ our $reloadTime; our $lmConf; our $localConfig; +my $conf = defined($GLOBAL::testInput) + ? $GLOBAL::testInput + : {}; + BEGIN { if ( MP() == 2 ) { eval { @@ -258,7 +262,7 @@ sub refresh($$) { return OK; } -__PACKAGE__->init( {} ); +__PACKAGE__->init( $conf ); 1; __END__ diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SecureToken.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SecureToken.pm index cf883c7b5..9121d2a57 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SecureToken.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SecureToken.pm @@ -5,6 +5,10 @@ # Secure Token # # Create a secure token used to resolve user identity by a protected application + +# This specific handler is intended to be called by a handler caller +# old working, kept for compatibility with previous 1.4.0 versions + package Lemonldap::NG::Handler::SecureToken; use strict; @@ -32,6 +36,15 @@ BEGIN { }; } +## @imethod protected void globalInit(hashRef args) +# Overload globalInit to launch this class defaultValuesInit +# @param $args reference to the configuration hash +sub globalInit { + my $class = shift; + __PACKAGE__->defaultValuesInit(@_); + $class->SUPER::globalInit(@_); +} + ## @imethod protected void defaultValuesInit(hashRef args) # Overload defaultValuesInit # @param $args reference to the configuration hash diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/AuthBasic.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/AuthBasic.pm index c75283925..ec5b12976 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/AuthBasic.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/AuthBasic.pm @@ -3,6 +3,9 @@ ##@class # Auth-basic authentication with Lemonldap::NG rights management + +# This specific handler is intended to be called directly by Apache + package Lemonldap::NG::Handler::SpecificHandlers::AuthBasic; use strict; diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/SecureToken.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/SecureToken.pm index 9a6d1dc2b..1c79b26bc 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/SecureToken.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/SecureToken.pm @@ -5,6 +5,9 @@ # Secure Token # # Create a secure token used to resolve user identity by a protected application + +# This specific handler is intended to be called directly by Apache + package Lemonldap::NG::Handler::SpecificHandlers::SecureToken; use strict; diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/SympaAutoLogin.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/SympaAutoLogin.pm index 0b210c4d2..ec75a1319 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/SympaAutoLogin.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/SympaAutoLogin.pm @@ -5,6 +5,9 @@ # Sympa autologin # # Build Sympa cookie and send it to Sympa + +# This specific handler is intended to be called directly by Apache + package Lemonldap::NG::Handler::SpecificHandlers::SympaAutoLogin; use strict; diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/UpdateCookie.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/UpdateCookie.pm index baec0c900..d387e322d 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/UpdateCookie.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/UpdateCookie.pm @@ -3,6 +3,9 @@ ## @class # Lemonldap::NG special handler + +# This specific handler is intended to be called directly by Apache + package Lemonldap::NG::Handler::SpecificHandlers::UpdateCookie; use strict; diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/ZimbraPreAuth.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/ZimbraPreAuth.pm index 33d57755a..64f398494 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/ZimbraPreAuth.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SpecificHandlers/ZimbraPreAuth.pm @@ -5,6 +5,9 @@ # Zimbra preauthentication # # It will build Zimbra preauth URL + +# This specific handler is intended to be called directly by Apache + package Lemonldap::NG::Handler::SpecificHandlers::ZimbraPreAuth; use strict; diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SympaAutoLogin.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SympaAutoLogin.pm index 8340f8ef5..6105c2c0f 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SympaAutoLogin.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SympaAutoLogin.pm @@ -5,6 +5,10 @@ # Sympa autologin # # Build Sympa cookie and send it to Sympa + +# This specific handler is intended to be called by a handler caller +# old working, kept for compatibility with previous 1.4.0 versions + package Lemonldap::NG::Handler::SympaAutoLogin; use strict; @@ -19,6 +23,15 @@ our $VERSION = '1.1.2'; # Shared variables our ( $sympaSecret, $sympaMailKey ); +## @imethod protected void globalInit(hashRef args) +# Overload globalInit to launch this class defaultValuesInit +# @param $args reference to the configuration hash +sub globalInit { + my $class = shift; + __PACKAGE__->defaultValuesInit(@_); + $class->SUPER::globalInit(@_); +} + ## @imethod protected void defaultValuesInit(hashRef args) # Overload defaultValuesInit # @param $args reference to the configuration hash diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/UpdateCookie.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/UpdateCookie.pm index 65782b1f7..7e16ffbb6 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/UpdateCookie.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/UpdateCookie.pm @@ -3,6 +3,10 @@ ## @class # Lemonldap::NG special handler + +# This specific handler is intended to be called by a handler caller +# old working, kept for compatibility with previous 1.4.0 versions + package Lemonldap::NG::Handler::UpdateCookie; use strict; diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/ZimbraPreAuth.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/ZimbraPreAuth.pm index 192adebcc..f574c3c2e 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/ZimbraPreAuth.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/ZimbraPreAuth.pm @@ -5,6 +5,10 @@ # Zimbra preauthentication # # It will build Zimbra preauth URL + +# This specific handler is intended to be called by a handler caller +# old working, kept for compatibility with previous 1.4.0 versions + package Lemonldap::NG::Handler::ZimbraPreAuth; use strict; @@ -20,6 +24,15 @@ our $VERSION = '1.0.0'; our ( $zimbraPreAuthKey, $zimbraAccountKey, $zimbraBy, $zimbraUrl, $zimbraSsoUrl, $timeout ); +## @imethod protected void globalInit(hashRef args) +# Overload globalInit to launch this class defaultValuesInit +# @param $args reference to the configuration hash +sub globalInit { + my $class = shift; + __PACKAGE__->defaultValuesInit(@_); + $class->SUPER::globalInit(@_); +} + ## @imethod protected void defaultValuesInit(hashRef args) # Overload defaultValuesInit # @param $args reference to the configuration hash