Lemonld...ndFactor(3)
β¨ Lemonld...ndFactor(3) β¨
okay so bestie, welcome to the Lemonld...ndFactor(3) page from the User Contributed Perl Documentation β yes that truncated name is literally how it's printed, no cap, it's giving mysterious π
π NAME π
Lemonldap::NG::Portal::Main::SecondFactor β the base class for Lemonldap::NG::Portal second factor plugins. it's the blueprint, the origin story, the main character your plugin extends π«Ά
πΈ SYNOPSIS πΈ
here's the whole vibe, verbatim, copy it into your soul (and your .pm file):
package Lemonldap::NG::Portal::2F::MySecondFactor;
use Mouse;
# Import used constants
use Lemonldap::NG::Portal::Main::Constants qw(
PE_OK
PE_BADCREDENTIALS
PE_SENDRESPONSE
);
extends 'Lemonldap::NG::Portal::Main::SecondFactor';
# INITIALIZATION
# Prefix that will be used in parameter names. The form used to enter the
# second factor must post its result to "/my2fcheck" (if "my" is the prefix).
has prefix => ( is => 'ro', default => 'my' );
# Optional logo
has logo => ( is => 'rw', default => 'mylogo.png' );
# Required init method
sub init {
my ($self) = @_;
# Insert here initialization process
#
# If self registration is enabled and "activation" is set to "enabled",
# replace the rule to detect if user has registered a device key.
# The rule must be like this :
# By example :
$self->conf->{totp2fActivation} = '$_2fDevices =~ /"type":\s*"TOTP"/s'
# Optionally, the rule can be : '$_2fDevices and $_2fDevices =~ /"type":\s*"TOTP"/s'
# to avoid warning due to undef variable
#
# Required call:
return $self->SUPER::init();
}
# RUNNING METHODS
# Required 2nd factor send method
sub run {
my ( $self, $req, $token ) = @_;
# $token must be inserted in a hidden input in your form with the name
# "token"
...
# A LLNG constant must be returned. Example:
$req->response($my_psgi_response);
return PE_SENDRESPONSE;
}
# Required 2nd factor verify method
sub verify {
my ( $self, $req, $session ) = @_;
# Use $req->param('field') to get POST responses
...
if ($result eq $goodResult) {
return PE_OK;
}
else {
return PE_BADCREDENTIALS;
}
}
1;
so like, key deets bestie: your prefix decides the param names β if it's my, your second-factor form has to post its result to "/my2fcheck" π. logo is optional and defaults to 'mylogo.png'. init is required and you gotta call $self->SUPER::init() at the end or nothing slays. run is the required send method, verify is the required check method. periodt.
also real talk: if self registration is enabled and"activation"is set to"enabled", you replace the rule that detects whether the user registered a device key. the rule has to look like thattotp2fActivationline up there. and optionally you can prefix it with$_2fDevices andto dodge warnings from an undef variable π
now go enable your little plugin in lemonldap-ng.ini, in the [portal] section:
<prefix>2fActivation(required):1,0or a rule<prefix>2fAuthnLevel(optional): changes the authentication level for users authenticated by this plugin
example, because examples are self-care π :
[portal]
customPlugins = Lemonldap::NG::Portal::2F::MyPlugin
my2fActivation = 1
my2fAuthnLevel = 4
π¦ DESCRIPTION π¦
Lemonldap::NG::Portal::Main::SecondFactor hands you a simple framework to build a Lemonldap::NG second authentication factor plugin. that's it, that's the whole job. it's the scaffolding, you bring the vibes β¨
want inspo? go peek at the Lemonldap::NG::Portal::Plugins::2F::* packages for examples. literal icons, all of them π
π SEE ALSO π
π OTHER POD FILES π
- Writing an authentication module:
Lemonldap::NG::Portal::Auth - Writing a UserDB module:
Lemonldap::NG::Portal::UserDB - Writing a second factor module:
Lemonldap::NG::Portal::Main::SecondFactor - Writing an issuer module:
Lemonldap::NG::Portal::Main::Issuer - Writing another plugin:
Lemonldap::NG::Portal::Main::Plugin - Request object:
Lemonldap::NG::Portal::Main::Request - Adding parameters in the manager:
Lemonldap::NG::Manager::Build
π AUTHORS π
LemonLDAP::NG team <http://lemonldap-ng.org/team> β the whole squad, obsessed with them fr fr π«Ά
π₯ BUG REPORT π₯
found a bug or got a feature request? use the OW2 system, bestie, that's the move:
<https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues>
π DOWNLOAD π
Lemonldap::NG is available at <https://lemonldap-ng.org/download> β go get it π
π 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/>.
ok so like, legally speaking: free software, GPL, v2 or later, no warranty, and if you didn't get a copy of the license, that link is right there. iykyk, don't skip the boring-but-binding part π
and that's a wrap on this page from perl v5.42.3, dated 2026-09-24 β the Lemonld...ndFactor(3) era, iconic behavior, no notes π
β¨
π¦ 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