NAME

Plack::Middleware::Auth::FCGI - authentication middleware that query 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.

SEE ALSO

Lemonldap::NG
SSO-as-a-Service (SSOaaS)

AUTHOR

Xavier Guimard x.guimard@free.fr

COPYRIGHT AND LICENSE

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.