Skip to content

Plack authentication middleware that query remote FastCGI server

License

Notifications You must be signed in to change notification settings

LemonLDAPNG/Plack-Middleware-Auth-FCGI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plack::Middleware::Auth::FCGI

Authentication middleware that queries remote FastCGI server

SYNOPSIS

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;
};

DESCRIPTION

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.

INSTALLATION

As usual for Perl packages:

perl Makefile.PL
make
make test
sudo make install

Dependencies

SEE ALSO

AUTHOR

Xavier Guimard

COPYRIGHT AND LICENSE

Copyright (C) 2018 by Xavier Guimard <[email protected]>

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.

About

Plack authentication middleware that query remote FastCGI server

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages