.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Lemonldap::NG::Portal::Main::SecondFactor 3pm" .TH Lemonldap::NG::Portal::Main::SecondFactor 3pm 2024-02-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Lemonldap::NG::Portal::Main::SecondFactor \- Base class for Lemonldap::NG::Portal second factor plugins. .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 9 \& 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 \*(AqLemonldap::NG::Portal::Main::SecondFactor\*(Aq; \& \& # 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 => \*(Aqro\*(Aq, default => \*(Aqmy\*(Aq ); \& # Optional logo \& has logo => ( is => \*(Aqrw\*(Aq, default => \*(Aqmylogo.png\*(Aq ); \& \& # 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\->{u2fActivation} = \*(Aq$_2fDevices =~ /"type":\es*"U2F"/s\*(Aq \& # Optionally, the rule can be : \*(Aq$_2fDevices and $_2fDevices =~ /"type":\es*"U2F"/s\*(Aq \& # 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(\*(Aqfield\*(Aq) to get POST responses \& ... \& if ($result eq $goodResult) { \& return PE_OK; \& } \& else { \& return PE_BADCREDENTIALS; \& } \& } \& 1; .Ve .PP Enable your plugin in lemonldap\-ng.ini, section [portal]: .IP "2fActivation (required): 1, 0 or a rule" 4 .IX Item "2fActivation (required): 1, 0 or a rule" .PD 0 .IP "2fAuthnLevel (optional): change authentication level for users authenticated by this plugin" 4 .IX Item "2fAuthnLevel (optional): change authentication level for users authenticated by this plugin" .PD .PP Example: .PP .Vb 4 \& [portal] \& customPlugins = Lemonldap::NG::Portal::2F::MyPlugin \& my2fActivation = 1 \& my2fAuthnLevel = 4 .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Lemonldap::NG::Portal::Main::SecondFactor provides a simple framework to build Lemonldap::NG second authentication factor plugin. .PP See Lemonldap::NG::Portal::Plugins::2F::* packages for examples. .SH "SEE ALSO" .IX Header "SEE ALSO" .SS "OTHER POD FILES" .IX Subsection "OTHER POD FILES" .IP "Writing an authentication module: Lemonldap::NG::Portal::Auth" 4 .IX Item "Writing an authentication module: Lemonldap::NG::Portal::Auth" .PD 0 .IP "Writing a UserDB module: Lemonldap::NG::Portal::UserDB" 4 .IX Item "Writing a UserDB module: Lemonldap::NG::Portal::UserDB" .IP "Writing a second factor module: Lemonldap::NG::Portal::Main::SecondFactor" 4 .IX Item "Writing a second factor module: Lemonldap::NG::Portal::Main::SecondFactor" .IP "Writing an issuer module: Lemonldap::NG::Portal::Main::Issuer" 4 .IX Item "Writing an issuer module: Lemonldap::NG::Portal::Main::Issuer" .IP "Writing another plugin: Lemonldap::NG::Portal::Main::Plugin" 4 .IX Item "Writing another plugin: Lemonldap::NG::Portal::Main::Plugin" .IP "Request object: Lemonldap::NG::Portal::Main::Request" 4 .IX Item "Request object: Lemonldap::NG::Portal::Main::Request" .IP "Adding parameters in the manager: Lemonldap::NG::Manager::Build" 4 .IX Item "Adding parameters in the manager: Lemonldap::NG::Manager::Build" .PD .SH AUTHORS .IX Header "AUTHORS" .IP "LemonLDAP::NG team " 4 .IX Item "LemonLDAP::NG team " .SH "BUG REPORT" .IX Header "BUG REPORT" Use OW2 system to report bug or ask for features: .SH DOWNLOAD .IX Header "DOWNLOAD" Lemonldap::NG is available at .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" See COPYING file for details. .PP 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. .PP 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. .PP You should have received a copy of the GNU General Public License along with this program. If not, see .