« blib/lib/Lemonldap/NG/Portal/Main/Auth.pm
↑ Summary
blib/lib/Lemonldap/NG/Portal/Lib/LazyLoadedConfiguration.pm »
| 1 | package Lemonldap::NG::Portal::Password::Combination; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Mouse; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Lemonldap::NG::Portal::Main::Constants qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | PE_OK | ||||||||||||||||||||||||||||
| 7 | PE_ERROR | ||||||||||||||||||||||||||||
| 8 | PE_FIRSTACCESS | ||||||||||||||||||||||||||||
| 9 | 1 | ); | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | extends 'Lemonldap::NG::Portal::Password::Base'; | |||||||||||||||||||||||||||
| 12 | 1 | with 'Lemonldap::NG::Portal::Lib::OverConf'; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 1 | our $VERSION = '2.0.16'; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | ▶ | has mods => ( is => 'rw', isa => 'HashRef', default => sub { {} } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=7 SCAR=23.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | # Check if expression exists | ||||||||||||||||||||||||||||
| 22 | 2 | ▶ | unless ( $self->conf->{combination} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 0 | $self->error('No combination found'); | |||||||||||||||||||||||||||
| 24 | 0 | return 0; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | # Load all declared modules | ||||||||||||||||||||||||||||
| 28 | 2 | my %mods; | |||||||||||||||||||||||||||
| 29 | 2 | foreach my $key ( keys %{ $self->conf->{combModules} } ) { | |||||||||||||||||||||||||||
| 30 | 4 | my $tmp; | |||||||||||||||||||||||||||
| 31 | 4 | my $mod = $self->conf->{combModules}->{$key}; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 4 | ▶ | unless ( $mod->{type} and defined $mod->{for} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$mod->{"type"} and defined $mod->{"for"}
MC/DC0%0/2
$mod->{"type"} and defined $mod->{"for"}
$mod->{"type"}
defined $mod->{"for"}
Truth table33%1/3
A and B
A= $mod->{"type"}B= defined $mod->{"for"}
| |||||||||||||||||||||||||||||
| 34 | 0 | $self->error("Malformed combination module $key"); | |||||||||||||||||||||||||||
| 35 | 0 | return 0; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | # Only load modules used for UserDB | ||||||||||||||||||||||||||||
| 39 | 4 | ▶ | unless ( $mod->{for} == 1 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | $tmp = | ||||||||||||||||||||||||||||
| 41 | 4 | $self->loadModule( "::Password::$mod->{type}", $mod->{over} ); | |||||||||||||||||||||||||||
| 42 | 4 | ▶ | unless ($tmp) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 0 | $self->logger->notice("Unable to load Password::$mod->{type}"); | |||||||||||||||||||||||||||
| 44 | 0 | next; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | # Store modules as array | ||||||||||||||||||||||||||||
| 49 | 4 | $self->mods->{$key} = $tmp; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | 2 | return $self->SUPER::init; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 4 | ▶ | sub delegate { | ||||||||||||||||||||||||||
|
Subroutine
delegate: called CC=3 SCAR=13.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 55 | 4 | my ( $self, $req, $name, @args ) = @_; | |||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | # The user might want to override which password DB is used with a macro | ||||||||||||||||||||||||||||
| 58 | # This is useful when using SASL delegation in OpenLDAP | ||||||||||||||||||||||||||||
| 59 | my $userDB = | ||||||||||||||||||||||||||||
| 60 | 4 | ▶ | $req->sessionInfo->{_cmbPasswordDB} || $req->sessionInfo->{_userDB}; | ||||||||||||||||||||||||||
|
Condition33%1/3
$req->sessionInfo->{'_cmbPasswordDB'} || $req->sessionInfo->{'_userDB'}
MC/DC0%0/2
$req->sessionInfo->{'_cmbPasswordDB'} || $req->sessionInfo->{'_userDB'}
$req->sessionInfo->{'_cmbPasswordDB'}
$req->sessionInfo->{'_userDB'}
Truth table33%1/3
A || B
A= $req->sessionInfo->{'_cmbPasswordDB'}B= $req->sessionInfo->{'_userDB'}
| |||||||||||||||||||||||||||||
| 61 | 4 | ▶ | unless ( $self->mods->{$userDB} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | 0 | $self->logger->error("No Password module available for $userDB"); | |||||||||||||||||||||||||||
| 63 | 0 | return PE_ERROR; | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 4 | return $self->mods->{$userDB}->$name( $req, @args ); | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 2 | ▶ | sub confirm { | ||||||||||||||||||||||||||
|
Subroutine
confirm: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 70 | 2 | my ( $self, $req, @args ) = @_; | |||||||||||||||||||||||||||
| 71 | 2 | return $self->delegate( $req, "confirm", @args ); | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 2 | ▶ | sub modifyPassword { | ||||||||||||||||||||||||||
|
Subroutine
modifyPassword: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 75 | 2 | my ( $self, $req, $pwd, %args ) = @_; | |||||||||||||||||||||||||||
| 76 | 2 | return $self->delegate( $req, "modifyPassword", $pwd, %args ); | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 1 | 1; | |||||||||||||||||||||||||||