2016-01-25 19:03:48 +01:00
|
|
|
package Lemonldap::NG::Handler::PSGI::Server;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Mouse;
|
2016-01-26 07:14:54 +01:00
|
|
|
use Lemonldap::NG::Handler::SharedConf qw(:tsv);
|
2016-01-25 19:03:48 +01:00
|
|
|
|
|
|
|
extends 'Lemonldap::NG::Handler::PSGI';
|
|
|
|
|
2016-01-31 23:53:23 +01:00
|
|
|
## @method void _run()
|
|
|
|
# Return subroutine that add headers stored in $req->{respHeaders} in
|
|
|
|
# response returned by router()
|
|
|
|
#
|
|
|
|
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);
|
2016-02-03 07:43:11 +01:00
|
|
|
push @{ $res->[1] }, %{ $req->{respHeaders} }, Cookie => $req->{Cookie};
|
2016-01-31 23:53:23 +01:00
|
|
|
return $res;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
## @method PSGI-Response router($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-01-25 19:03:48 +01:00
|
|
|
sub router {
|
2016-01-31 23:53:23 +01:00
|
|
|
return [ 200, [ 'Content-Length', 0 ], [] ];
|
2016-01-25 19:03:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|