Plack::Middleware::Auth::FCGI - authentication middleware that query remote FastCGI server
use Plack::Builder; my $app = sub { my $env = shift; # FastCGI auth response headers are stored in $env->{fcgiauth-<header>} # in lower case. Example if FastCGI auth server populates 'Auth-User' header: my $user = $env->{fcgiauth-auth-user}; #... return [ 200, [ 'Content-Type' => 'text/plain' ], [ "Hello $user" ] ]; }; # Optionally ($fcgiResponse is the PSGI response of remote FCGI auth server) #sub on_reject { # my($self,$env,$fcgiResponse) = @_; # my $statusCode = $fcgiResponse->{status}; # ... #} builder { enable "Auth::FCGI", host => '127.0.0.1', port => '9090', # Optional parameters to give to remote FCGI server #fcgi_auth_params => { # RULES_URL => 'https://my-server/my.json', #}, # Optional rejection subroutine #on_reject => \&on_reject; ; $app; };
Plack::Middleware::Auth::FCGI permits to protect an application by querying a remote FastCGI server (like Nginx auth_request).
It can be used with Lemonldap::NG in a SSO-as-a-Service (SSOaaS) system.
Xavier Guimard x.guimard@free.fr
Copyright (C) 2018 by Xavier Guimard x.guimard@free.fr
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.26.2 or, at your option, any later version of Perl 5 you may have available.
To install Plack::Middleware::Auth::FCGI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Middleware::Auth::FCGI
CPAN shell
perl -MCPAN -e shell install Plack::Middleware::Auth::FCGI
For more information on module installation, please visit the detailed CPAN module installation guide.