Lemonldap::NG::Handler::PSGI - Base library for protected PSGI applications.
package My::PSGI; use base Lemonldap::NG::Handler; sub init { my ($self,$args) = @_; $self->protection('manager'); # See Lemonldap::NG::Common::PSGI for more ... # Return a boolean. If false, then error message has to be stored in # $self->error return 1; } sub handler { my ( $self, $req ) = @_; # Will be called only if authorisated my $userId = $self->userId; ... $self->sendJSONresponse(...); }
This package could then be called as a CGI, using FastCGI,...
#!/usr/bin/env perl use My::PSGI; use Plack::Handler::FCGI; # or Plack::Handler::CGI Plack::Handler::FCGI->new->run( My::PSGI->run() );
This package provides base class for Lemonldap::NG protected REST API.
See Lemonldap::NG::Common::PSGI for logging methods, content sending,...
See Lemonldap::NG::Common::PSGI::Router for inherited accessors.
Level of protection. It can be one of:
Returns user session datas. If empty (no protection), returns:
{ _whatToTrace => 'anonymous' }
But if page is protected by server (Auth-Basic,...), it will return:
{ _whatToTrace => $REMOTE_USER }
Returns user()->{'_whatToTrace'}.
Returns a list of groups to which user belongs.
http://lemonldap-ng.org/, Lemonldap::NG::Portal, Lemonldap::NG::Handler, Plack, PSGI, Lemonldap::NG::Common::PSGI::Router, Lemonldap::NG::Common::PSGI::Request, HTML::Template,
Use OW2 system to report bug or ask for features: http://jira.ow2.org
Lemonldap::NG is available at http://forge.objectweb.org/project/showfiles.php?group_id=274
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
To install Lemonldap::NG::Handler, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lemonldap::NG::Handler
CPAN shell
perl -MCPAN -e shell install Lemonldap::NG::Handler
For more information on module installation, please visit the detailed CPAN module installation guide.