1Lemonldap::NG::Handler:U:sPeSrGIC(o3n)tributed Perl DocuLmeemnotnaltdiaopn::NG::Handler::PSGI(3)
2
3
4

NAME

6       Lemonldap::NG::Handler::PSGI - Base library for protected PSGI
7       applications.
8

SYNOPSIS

10         package My::PSGI;
11
12         use base Lemonldap::NG::Handler;
13
14         sub init {
15           my ($self,$args) = @_;
16           $self->protection('manager');
17           # See Lemonldap::NG::Common::PSGI for more
18           ...
19           # Return a boolean. If false, then error message has to be stored in
20           # $self->error
21           return 1;
22         }
23
24         sub handler {
25           my ( $self, $req ) = @_;
26
27           # Will be called only if authorisated
28           my $userId = $self->userId;
29           ...
30           $self->sendJSONresponse(...);
31         }
32
33       This package could then be called as a CGI, using FastCGI,...
34
35         #!/usr/bin/env perl
36
37         use My::PSGI;
38         use Plack::Handler::FCGI; # or Plack::Handler::CGI
39
40         Plack::Handler::FCGI->new->run( My::PSGI->run() );
41

DESCRIPTION

43       This package provides base class for Lemonldap::NG protected REST API.
44

METHODS

46       See Lemonldap::NG::Common::PSGI for logging methods, content
47       sending,...
48
49   Accessors
50       See Lemonldap::NG::Common::PSGI::Router for inherited accessors.
51
52       protection
53
54       Level of protection. It can be one of:
55
56       'none': no protection
57       'authenticate': all authenticated users are granted
58       'manager': access is granted following Lemonldap::NG rules
59
60   Running methods
61       user
62
63       Returns user session data. If empty (no protection), returns:
64
65         { _whatToTrace => 'anonymous' }
66
67       But if page is protected by server (Auth-Basic,...), it will return:
68
69         { _whatToTrace => $REMOTE_USER }
70
71       UserId
72
73       Returns user()->{'_whatToTrace'}.
74
75       group
76
77       Returns a list of groups to which user belongs.
78

SEE ALSO

80       <http://lemonldap-ng.org/>, Lemonldap::NG::Portal,
81       Lemonldap::NG::Handler, Plack, PSGI,
82       Lemonldap::NG::Common::PSGI::Router,
83       Lemonldap::NG::Common::PSGI::Request, HTML::Template,
84

AUTHORS

86       LemonLDAP::NG team <http://lemonldap-ng.org/team>
87

BUG REPORT

89       Use OW2 system to report bug or ask for features:
90       <https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues>
91

DOWNLOAD

93       Lemonldap::NG is available at <https://lemonldap-ng.org/download>
94
96       See COPYING file for details.
97
98       This library is free software; you can redistribute it and/or modify it
99       under the terms of the GNU General Public License as published by the
100       Free Software Foundation; either version 2, or (at your option) any
101       later version.
102
103       This program is distributed in the hope that it will be useful, but
104       WITHOUT ANY WARRANTY; without even the implied warranty of
105       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
106       General Public License for more details.
107
108       You should have received a copy of the GNU General Public License along
109       with this program.  If not, see <http://www.gnu.org/licenses/>.
110
111
112
113perl v5.38.0                      2023-11-14   Lemonldap::NG::Handler::PSGI(3)
Impressum