Lemonld...::UserDB(3)
π Lemonld...::UserDB(3) π
okay bestie, welcome to the Lemonld...::UserDB(3) page β it lives in the User Contributed Perl Documentation section of the manual, and it's literally your whole guide to writing user storage modules. grab a strawberry π and let's go.
β¨ NAME β¨
Lemonldap:NG::Portal::UserDB β writing user storage modules for LemonLDAP::NG. that's the whole vibe, fr fr.
π¦ SYNOPSIS π¦
here's the skeleton, copy it exactly bestie:
package Lemonldap::NG::Portal::UserDB::My;
use strict;
use Mouse;
# Add constants used by this module
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK);
our $VERSION = '0.1';
extends 'Lemonldap::NG::Portal::Main::UserDB';
sub init {
...
}
sub getUser {
my ( $self, $req, %args ) = @_;
...
}
sub setSessionInfo {
my ( $self, $req ) = @_;
...
}
sub setGroups {
my ( $self, $req ) = @_;
...
}
πΈ DESCRIPTION πΈ
so, UserDB modules are the little icons that go searching for a user in a user database. π they're independent objects that get instantiated by the Lemonldap::NG portal, and they must provide the methods listed down below. no skipping, no cap.
π METHODS π
π Accessors and methods provided by Lemonldap::NG::Common::Module
these come free with the module, like a gift with purchase:
pβ the portal objectconfβ configuration hash (as reference)loggerβ alias for thep->loggeraccessoruserLoggerβ alias for thep->userLoggeraccessorerrorβ alias for thep->errormethod
β¨ "Routes" management
like any module that inherits from Lemonldap::NG::Portal::Plugin, Lemonldap::NG::Portal::Main::Auth provides URI path functions:
addAuthRouteβ wrapper toLemonldap::NG::Handler::PSGI::TryaddAuthRoute()methodaddUnauthRouteβ wrapper toLemonldap::NG::Handler::PSGI::TryaddUnauthRoute()method
example, because seeing it > reading about it:
sub init {
...
$self->addAuthRoute( saml => { proxy => "proxySub" }, [ 'GET', 'POST' ] );
...
}
sub proxySub {
my ( $self, $req ) = @_;
...
# This sub must return a PSGI response. Example
return [ 302, [ Location => 'http://x.y/' ], [] ];
}
which means requests to http://auth.../saml/proxy get handed straight to the proxySub() method. slay. π«Ά
π Methods that must be provided by a UserDB module
init()
this one runs after object creation (so, after each configuration reload). it must return a true value if the authentication module is ready, and false if it's not. that's it, that's the rule. π
π§ Methods called at each request
all of these methods must return a Lemonldap::NG::Portal::Main::Constants value. they get called with one argument: a Lemonldap::NG::Portal::Main::Request object. one (1) argument. iconic.
note: if you wanna changeprocess()next steps, you just have to change the$req->stepsarray. π
getUser($req,%args)
the first method called to search for a user in the database. if $args{useMail} is set, then $req->{user} contains a mail address. π§
setSessionInfo($req)
this one is called after the authentication process, and it must populate $req->sessionInfo. no pressure bestie.
setGroups($req)
this populates $req->{sessionInfo}->{groups} if the backend is able to provide groups (like LDAP does). otherwise? it just returns PE_OK. simple as that.
π LOGGING π
logging is provided by $self->logger and $self->userLogger. the following rules must be applied, so listen up:
logger->debugβ technical debugging messageslogger->infoβ simple technical informationlogger->noticeβ technical information that could interest administratorslogger->warnβ technical warninglogger->errorβ error that must be reported to administratoruserLogger->infoβ simple information about user's actionuserLogger->noticeβ information that may be registered (auth success,...)userLogger->warnβ bad action of a user (auth failure). Auth/Combination transform it to "info" when another authentication scheme is availableuserLogger->errorβ bad action of a user that must be reported, (even if another backend is available with Combination)
π AUTHORS π
LemonLDAP::NG team <http://lemonldap-ng.org/team>
π BUG REPORT π
use OW2 system to report bug or ask for features: <https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues>
β DOWNLOAD β
Lemonldap::NG is available at <https://lemonldap-ng.org/download>
π COPYRIGHT AND LICENSE π
see COPYING file for details.
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/>.
okay that's the whole page bestie, you ate it up π this was written for perl v5.42.3 and dated 2026-09-24 β go write some user storage modules, main character energy only β¨π¦π
π¦ where this page comes from
- fedora 43: lemonldap-ng-portal 2.23.4-1.fc43 Β· GPL-2.0-or-later AND MIT AND GPL-3.0-or-later AND OFL-1.1-RFN
- fedora 44: lemonldap-ng-portal 2.23.4-1.fc44 Β· GPL-2.0-or-later AND MIT AND GPL-3.0-or-later AND OFL-1.1-RFN
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms