2017-02-16 08:37:40 +01:00
|
|
|
# LLNG platform class for FastCGI handler (Nginx)
|
|
|
|
#
|
2019-02-04 20:58:04 +01:00
|
|
|
# See https://lemonldap-ng.org/documentation/latest/handlerarch
|
2017-02-11 08:47:22 +01:00
|
|
|
package Lemonldap::NG::Handler::Server;
|
2016-01-25 19:03:48 +01:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Mouse;
|
2017-02-11 08:47:22 +01:00
|
|
|
use Lemonldap::NG::Handler::Server::Main;
|
2016-03-17 23:19:44 +01:00
|
|
|
|
2019-09-12 21:56:49 +02:00
|
|
|
our $VERSION = '2.0.6';
|
2016-01-25 19:03:48 +01:00
|
|
|
|
|
|
|
extends 'Lemonldap::NG::Handler::PSGI';
|
|
|
|
|
2016-03-17 23:19:44 +01:00
|
|
|
sub init {
|
|
|
|
my $self = shift;
|
2017-02-11 08:47:22 +01:00
|
|
|
$self->api('Lemonldap::NG::Handler::Server::Main');
|
2016-03-17 23:19:44 +01:00
|
|
|
my $tmp = $self->SUPER::init(@_);
|
|
|
|
}
|
|
|
|
|
2016-01-31 23:53:23 +01:00
|
|
|
## @method void _run()
|
|
|
|
# Return subroutine that add headers stored in $req->{respHeaders} in
|
2016-02-11 07:00:35 +01:00
|
|
|
# response returned by handler()
|
2016-01-31 23:53:23 +01:00
|
|
|
#
|
|
|
|
sub _run {
|
|
|
|
my ($self) = @_;
|
|
|
|
return sub {
|
2016-02-01 23:22:33 +01:00
|
|
|
my $req = Lemonldap::NG::Common::PSGI::Request->new( $_[0] );
|
|
|
|
my $res = $self->_authAndTrace($req);
|
2019-08-28 00:36:18 +02:00
|
|
|
push @{ $res->[1] }, $req->spliceHdrs,
|
2019-08-26 23:13:17 +02:00
|
|
|
Cookie => ( $req->{Cookie} // '' );
|
2016-01-31 23:53:23 +01:00
|
|
|
return $res;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-02-11 07:00:35 +01:00
|
|
|
## @method PSGI-Response handler($req)
|
2016-01-30 13:26:14 +01:00
|
|
|
# If PSGI is used as an authentication FastCGI only, this method will be
|
2016-01-31 23:53:23 +01:00
|
|
|
# called for authenticated users and returns only 200. Headers are set by
|
|
|
|
# Lemonldap::NG::Handler::PSGI.
|
2016-01-30 13:26:14 +01:00
|
|
|
# @param $req Lemonldap::NG::Common::PSGI::Request
|
2016-02-11 07:00:35 +01:00
|
|
|
sub handler {
|
2016-01-31 23:53:23 +01:00
|
|
|
return [ 200, [ 'Content-Length', 0 ], [] ];
|
2016-01-25 19:03:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|