2017-02-16 08:37:40 +01:00
|
|
|
# LLNG platform class for Apache-2/ModPerl-2
|
|
|
|
#
|
2019-02-04 20:58:04 +01:00
|
|
|
# See https://lemonldap-ng.org/documentation/latest/handlerarch
|
2016-03-17 23:19:44 +01:00
|
|
|
package Lemonldap::NG::Handler::ApacheMP2;
|
|
|
|
|
|
|
|
use strict;
|
2017-03-28 23:07:49 +02:00
|
|
|
use Lemonldap::NG::Handler::ApacheMP2::Request;
|
2016-03-17 23:19:44 +01:00
|
|
|
|
2017-02-08 23:18:52 +01:00
|
|
|
use Lemonldap::NG::Handler::ApacheMP2::Main;
|
2016-03-17 23:19:44 +01:00
|
|
|
|
|
|
|
our $VERSION = '2.0.0';
|
|
|
|
|
|
|
|
# PUBLIC METHODS
|
|
|
|
|
|
|
|
sub handler {
|
2017-02-09 07:24:12 +01:00
|
|
|
shift if ($#_);
|
2017-03-28 23:07:49 +02:00
|
|
|
return launch( 'run', @_ );
|
2017-02-09 07:24:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub logout {
|
|
|
|
shift if ($#_);
|
2017-03-28 23:07:49 +02:00
|
|
|
return launch( 'unlog', @_ );
|
2017-02-09 07:24:12 +01:00
|
|
|
}
|
|
|
|
|
2017-08-25 11:38:41 +02:00
|
|
|
sub reload {
|
|
|
|
shift if ($#_);
|
|
|
|
return launch( 'reload', @_ );
|
|
|
|
}
|
|
|
|
|
2017-02-09 07:24:12 +01:00
|
|
|
sub status {
|
|
|
|
shift if ($#_);
|
2017-03-28 23:07:49 +02:00
|
|
|
return launch( 'getStatus', @_ );
|
2017-02-09 07:24:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Internal method to get class to load
|
2017-03-28 23:07:49 +02:00
|
|
|
sub launch {
|
|
|
|
my ( $sub, $r ) = @_;
|
2017-03-29 07:02:56 +02:00
|
|
|
my $req = Lemonldap::NG::Handler::ApacheMP2::Request->new($r);
|
2017-03-28 23:07:49 +02:00
|
|
|
my $type = Lemonldap::NG::Handler::ApacheMP2::Main->checkType($req);
|
2017-03-29 07:02:56 +02:00
|
|
|
if ( my $t = $r->dir_config('VHOSTTYPE') ) {
|
2017-02-11 17:19:25 +01:00
|
|
|
$type = $t;
|
|
|
|
}
|
2017-02-08 23:18:52 +01:00
|
|
|
my $class = "Lemonldap::NG::Handler::ApacheMP2::$type";
|
|
|
|
eval "require $class";
|
2017-02-09 07:24:12 +01:00
|
|
|
die $@ if ($@);
|
2021-10-08 11:09:40 +02:00
|
|
|
|
|
|
|
# register the request object to the logging system
|
|
|
|
if ( ref( $class->logger ) and $class->logger->can('setRequestObj') ) {
|
|
|
|
$class->logger->setRequestObj($req);
|
|
|
|
}
|
|
|
|
if ( ref( $class->userLogger ) and $class->userLogger->can('setRequestObj') ) {
|
|
|
|
$class->userLogger->setRequestObj($req);
|
|
|
|
}
|
|
|
|
|
2017-03-29 07:17:35 +02:00
|
|
|
my ($res) = $class->$sub($req);
|
2021-10-08 11:09:40 +02:00
|
|
|
|
|
|
|
# Clear the logging system before the next request
|
|
|
|
if ( ref( $class->logger ) and $class->logger->can('clearRequestObj') ) {
|
|
|
|
$class->logger->clearRequestObj($req);
|
|
|
|
}
|
|
|
|
if ( ref( $class->userLogger ) and $class->userLogger->can('clearRequestObj') ) {
|
|
|
|
$class->userLogger->clearRequestObj($req);
|
|
|
|
}
|
2017-03-29 07:17:35 +02:00
|
|
|
return $res;
|
2016-03-17 23:19:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|