Lemonld...al::Auth(3)
π NAME π
Lemonldap:NG::Portal::Auth β bestie, this is the page about writing authentication modules for LemonLDAP::NG. Like, you're literally building the thing that decides who gets in. Main character energy fr fr. π
β¨ SYNOPSIS β¨
Okay so here's the whole vibe of what your module looks like, no cap:
package Lemonldap::NG::Portal::Auth::My;
use strict;
use Mouse;
# Add constants used by this module
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK);
our $VERSION = '0.1';
# Directive provides by Mouse
extends 'Lemonldap::NG::Portal::Main::Auth';
sub init {
...
}
sub extractFormInfo {
my ( $self, $req ) = @_;
...
}
sub authenticate {
my ( $self, $req ) = @_;
...
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
...
}
sub authLogout {
my ( $self, $req ) = @_;
...
}
sub getDisplayType {
return ...;
}
1;
Look at that. She's gorgeous. π
π¦ DESCRIPTION π¦
So basically, Lemonldap::NG::Portal::Main::Auth is the thing you have to use to build LemonLDAP::NG authentication modules. That's not optional, that's the blueprint.
Authentication modules are independent objects β like, they have their own little lives β and they get instantiated by the LemonLDAP::NG portal. And they must provide the methods described down below. Periodt. No skipping. π
π METHODS π
π Accessors and methods provided by Lemonldap::NG::Portal::Main::Auth
These come free with the base class, you don't have to write them, you just get to use them. Obsessed.
pβ the portal objectconfβ configuration hash (as reference)loggerβ alias for thep->loggeraccessoruserLoggerβ alias for thep->userLoggeraccessorerrorβ alias for thep->errormethodauthnLevelβ Lemonldap::NG authentication level
π£οΈ "Routes" management
Just like every module that inherits from Lemonldap::NG::Portal::Plugin, Lemonldap::NG::Portal::Main::Auth hands you URI path functions:
addAuthRouteβ wrapper to theLemonldap::NG::Handler::PSGI::TryaddAuthRoute()methodaddUnauthRouteβ wrapper to theLemonldap::NG::Handler::PSGI::TryaddUnauthRoute()method
Example, because a visual is always helpful:
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/' ], [] ];
}
So what this is saying is: requests to http://auth.../saml/proxy get handed off to the proxySub() method. Simple as that. π«Ά
π Methods that must be provided by an authentication module
init()
Method launched after object creation β and yes, that means after each configuration reload too, so she gets re-run. It must return a true value if the authentication module is ready, and false if it's not. That's it, that's the whole job.
π¬ Methods called at each request
All of these methods must return a Lemonldap::NG::Portal::Main::Constants value. And they're called with one argument: a Lemonldap::NG::Portal::Main::Request object.
π‘ Note: if you want to changeprocess()next steps, you literally just have to change the$req->stepsarray. That's the whole hack.
extractFormInfo($req)β the first authentication method called during the authentication process. It must set$req->user, which is the thing the userDB object is gonna use to go get user information. Set it or the whole thing falls apart, bestie.authenticate($req)β the last method called during the authentication process. The finale. π¬setAuthSessionInfo($req)β method that must at least set$req->{sessionInfo}->{authenticationLevel}to an integer that indicates the strong of authentication.
Proposed levels, so you know what number means what:
- low level
- web form level
- session based level (Kerberos for example)
- strong authentication
authForce($req)authLogout($req)
(Yeah, those last two are just listed. They're yours to figure out. Slay. π )
π’ LOGGING π’
Logging is provided by $self->logger and $self->userLogger. And these rules must be applied β they're not suggestions, they're the rules:
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> β the whole squad, iconic, we love them.
π BUG REPORT π
Found a bug? Need a feature? Use the OW2 system to report bug or ask for features:
<https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues>
They want to hear from you, fr fr. Don't be shy. πΈ
πΎ DOWNLOAD πΎ
Lemonldap::NG is available at <https://lemonldap-ng.org/download>
Go get her. πβοΈπ¨
π 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. Like, for real, no warranty. None. Zero. π
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
And that's the whole page, bestie! This was brought to you by perl v5.42.3 on 2026-09-24, straight out of the User Contributed Perl Documentation corner of the internet. Take care of your auth modules and they'll take care of you. π§πβ¨
π¦ 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