lemonldap-ng/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Server.pm

45 lines
1.1 KiB
Perl
Raw Normal View History

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;
use strict;
use Mouse;
2017-02-11 08:47:22 +01:00
use Lemonldap::NG::Handler::Server::Main;
our $VERSION = '2.0.6';
extends 'Lemonldap::NG::Handler::PSGI';
sub init {
my $self = shift;
2017-02-11 08:47:22 +01:00
$self->api('Lemonldap::NG::Handler::Server::Main');
my $tmp = $self->SUPER::init(@_);
}
## @method void _run()
# Return subroutine that add headers stored in $req->{respHeaders} in
# response returned by handler()
#
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,
Cookie => ( $req->{Cookie} // '' );
return $res;
};
}
## @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
# 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
sub handler {
return [ 200, [ 'Content-Length', 0 ], [] ];
}
1;