lemonldap-ng/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Demo.pm

48 lines
804 B
Perl
Raw Normal View History

2016-03-30 07:47:38 +02:00
##@file
# Demo authentication backend file
##@class
# Demo authentication backend class
package Lemonldap::NG::Portal::Auth::Demo;
use strict;
use Mouse;
2016-05-22 14:22:59 +02:00
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_BADCREDENTIALS);
2016-03-30 07:47:38 +02:00
extends qw(Lemonldap::NG::Portal::Auth::_WebForm);
our $VERSION = '2.0.0';
use constant AuthnLevel => 0;
2016-06-09 20:40:20 +02:00
# INITIALIZATION
2016-03-30 07:47:38 +02:00
# Initialize demo accounts
# @return Lemonldap::NG::Portal constant
sub init {
my $self = shift;
# Add warning in log
$self->lmLog(
2017-01-14 09:17:42 +01:00
"Using demonstration mode, go to Manager to edit the configuration",
2016-03-30 07:47:38 +02:00
'warn' );
2016-04-03 18:27:22 +02:00
1;
2016-03-30 07:47:38 +02:00
}
2016-06-09 20:40:20 +02:00
# RUNNING METHODS
2016-03-30 07:47:38 +02:00
sub authenticate {
2016-04-29 09:27:26 +02:00
my ( $self, $req ) = @_;
2016-03-30 07:47:38 +02:00
2016-05-02 12:30:23 +02:00
return PE_BADCREDENTIALS unless ( $req->{user} eq $req->datas->{password} );
2016-03-30 07:47:38 +02:00
PE_OK;
}
sub authLogout {
PE_OK;
}
1;