Merge branch '2589' into 'v2.0'

2589

See merge request lemonldap-ng/lemonldap-ng!215
This commit is contained in:
Christophe Maudoux 2021-08-20 18:09:46 +00:00
commit 57372ba5b7
29 changed files with 188 additions and 131 deletions

View File

@ -22,6 +22,13 @@ Just enable it in the Manager (section “plugins”). Then, set searching attri
- **Searching attributes**: For each attribute, you have to set a key (attribute as defined in UserBD) and a value that will be display in login form (placeholder). A value can be a multivalued list separated by multiValuesSeparator parameter (General Parameters > Advanced parameters > Separator). See note below. - **Searching attributes**: For each attribute, you have to set a key (attribute as defined in UserBD) and a value that will be display in login form (placeholder). A value can be a multivalued list separated by multiValuesSeparator parameter (General Parameters > Advanced parameters > Separator). See note below.
- **Excluding attributes**: You can defined here attributes used for excluding accounts. Set keys corresponding to UserBD attributes and values to exclude. A value can be a multivalued list separated by multiValuesSeparator parameter (General Parameters > Advanced parameters > Separator) - **Excluding attributes**: You can defined here attributes used for excluding accounts. Set keys corresponding to UserBD attributes and values to exclude. A value can be a multivalued list separated by multiValuesSeparator parameter (General Parameters > Advanced parameters > Separator)
.. note::
By default, simple searching attributes are mandatory to restrict the number of entries to return. To set an attribute as optional,
you can use the following syntax ::
uid##1 => UID
.. note:: .. note::
You can provide a 'multiValuesSeparator' separated list of allowed searching values that will be displayed as an HTML <select> list :: You can provide a 'multiValuesSeparator' separated list of allowed searching values that will be displayed as an HTML <select> list ::
@ -36,10 +43,6 @@ Just enable it in the Manager (section “plugins”). Then, set searching attri
Entries are sorted by alphabetical order. Entries are sorted by alphabetical order.
.. attention::
LDAP filter works only if an objectClass is set.
.. attention:: .. attention::
Searching request is built based on provided parameters value depending on users backend like this: Searching request is built based on provided parameters value depending on users backend like this:
@ -53,8 +56,3 @@ Just enable it in the Manager (section “plugins”). Then, set searching attri
.. danger:: .. danger::
With AuthChoice, you must set which module will be called by this plugin (:doc:`Backend choice by users<authchoice>`). With AuthChoice, you must set which module will be called by this plugin (:doc:`Backend choice by users<authchoice>`).
.. |image0| image:: /documentation/beta.png
:width: 100px

View File

@ -710,7 +710,7 @@ t/68-FindUser-with-Choice-and-token.t
t/68-FindUser-with-Combination.t t/68-FindUser-with-Combination.t
t/68-FindUser-with-DBI.t t/68-FindUser-with-DBI.t
t/68-FindUser-with-Demo-and-captcha.t t/68-FindUser-with-Demo-and-captcha.t
t/68-FindUser-with-Demo-and-required-select.t t/68-FindUser-with-Demo-and-required-params.t
t/68-FindUser-with-Demo-and-token.t t/68-FindUser-with-Demo-and-token.t
t/68-FindUser-with-Demo.t t/68-FindUser-with-Demo.t
t/68-FindUser-with-LDAP.t t/68-FindUser-with-LDAP.t
@ -760,7 +760,7 @@ t/78-2F-UpgradeOnly.t
t/79-2F-Yubikey-from-Session.t t/79-2F-Yubikey-from-Session.t
t/79-2F-Yubikey.t t/79-2F-Yubikey.t
t/90-Translations.t t/90-Translations.t
t/91-handler-cache-cleaned.t t/91-Handler-cache-cleaned.t
t/91-Memory-Leak.t t/91-Memory-Leak.t
t/99-Dont-load-Dumper.t t/99-Dont-load-Dumper.t
t/99-pod.t t/99-pod.t

View File

@ -13,7 +13,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
extends 'Lemonldap::NG::Common::Module'; extends 'Lemonldap::NG::Common::Module';
our $VERSION = '2.0.12'; our $VERSION = '2.0.13';
# PROPERTIES # PROPERTIES
@ -76,8 +76,7 @@ has findUserFilter => (
is => 'ro', is => 'ro',
lazy => 1, lazy => 1,
builder => sub { builder => sub {
$_[0]->conf->{AuthLDAPFilter} ||
# $_[0]->conf->{AuthLDAPFilter} ||
$_[0]->conf->{LDAPFilter} $_[0]->conf->{LDAPFilter}
|| '(&(uid=$user)(objectClass=inetOrgPerson))'; || '(&(uid=$user)(objectClass=inetOrgPerson))';
} }
@ -180,8 +179,10 @@ sub findUser {
$self->validateLdap; $self->validateLdap;
return PE_LDAPCONNECTFAILED unless $self->ldap; return PE_LDAPCONNECTFAILED unless $self->ldap;
$self->findUserFilter =~ /\bobjectClass=(\w+)\b/; my $filter =
my $filter = "(&(objectClass=$1)"; $self->findUserFilter =~ /\bobjectClass=(\w+)\b/
? "(&(objectClass=$1)"
: '(&';
my $wildcard = $self->conf->{findUserWildcard}; my $wildcard = $self->conf->{findUserWildcard};
$self->logger->info("LDAP UserDB with wildcard ($wildcard)") if $wildcard; $self->logger->info("LDAP UserDB with wildcard ($wildcard)") if $wildcard;
foreach (@$searching) { foreach (@$searching) {
@ -204,6 +205,7 @@ sub findUser {
filter => $filter, filter => $filter,
deref => $self->conf->{ldapSearchDeref} || 'find', deref => $self->conf->{ldapSearchDeref} || 'find',
attrs => $self->attrs, attrs => $self->attrs,
sizelimit => 50
); );
if ( $mesg->code() != 0 ) { if ( $mesg->code() != 0 ) {
@ -218,9 +220,10 @@ sub findUser {
my $rank = int( rand( $mesg->count() ) ); my $rank = int( rand( $mesg->count() ) );
$self->logger->debug("Demo UserDB random rank: $rank"); $self->logger->debug("Demo UserDB random rank: $rank");
my $entry = my $entry =
( $mesg->entry($rank)->dn() =~ /\b(?:uid|sAMAccountName)=(\w+?)\b/ ) ( $mesg->entry($rank)->dn() =~ /\b(?:uid|sAMAccountName)\x3d(.+?),/ )
[0]; [0] || '';
$self->userLogger->info("FindUser: LDAP UserDB returns $entry"); $self->userLogger->info("FindUser: LDAP UserDB returns $entry")
if $entry;
$req->data->{findUser} = $entry; $req->data->{findUser} = $entry;
return PE_OK; return PE_OK;
} }

View File

@ -479,7 +479,6 @@ sub display {
MSG => $req->info(), MSG => $req->info(),
LOCKTIME => $req->lockTime(), LOCKTIME => $req->lockTime(),
); );
} }
# Display authentication form # Display authentication form
@ -517,9 +516,8 @@ sub display {
); );
} }
# Choose what form to display if not in a loop # Choose which form to display if not in a loop
else { else {
my $displayType = my $displayType =
eval { $self->_authentication->getDisplayType($req) } eval { $self->_authentication->getDisplayType($req) }
|| 'logo'; || 'logo';

View File

@ -9,7 +9,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
PE_TOKENEXPIRED PE_TOKENEXPIRED
); );
our $VERSION = '2.0.12'; our $VERSION = '2.0.13';
extends qw( extends qw(
Lemonldap::NG::Portal::Main::Plugin Lemonldap::NG::Portal::Main::Plugin
@ -32,8 +32,10 @@ sub init {
my ($self) = @_; my ($self) = @_;
( my $imp = grep /::Plugins::Impersonation$/, $self->p->enabledPlugins ) ( my $imp = grep /::Plugins::Impersonation$/, $self->p->enabledPlugins )
? $self->addUnauthRoute( finduser => 'provideUser', ['POST'] ) ? $self->addUnauthRoute( finduser => 'provideUser', ['POST'] )
->addAuthRoute( finduser => 'provideUser', ->addAuthRoute(
['POST'] ) # Allow findUser with reAuth finduser => 'provideUser',
['POST']
) # Allow findUser with reAuth
: $self->logger->warn('FindUser plugin enabled without Impersonation'); : $self->logger->warn('FindUser plugin enabled without Impersonation');
$self->logger->warn('FindUser plugin enabled without searching attribute') $self->logger->warn('FindUser plugin enabled without searching attribute')
unless keys %{ $self->conf->{findUserSearchingAttributes} }; unless keys %{ $self->conf->{findUserSearchingAttributes} };
@ -87,9 +89,9 @@ sub retreiveFindUserParams {
my $regex = '^(?:' . join( '|', keys %values ) . ')$'; my $regex = '^(?:' . join( '|', keys %values ) . ')$';
my $checked = my $checked =
$select $select
? $param =~ /$regex/o ? $param =~ /$regex/
: $param =~ /$self->{conf}->{findUserControl}/o; : $param =~ /$self->{conf}->{findUserControl}/;
push @required, $key if $select && !$null; push @required, $key unless $null;
# For <select>, accept only set values or empty if allowed # For <select>, accept only set values or empty if allowed
if ( $defined && $checked ) { if ( $defined && $checked ) {
@ -97,9 +99,12 @@ sub retreiveFindUserParams {
{ key => $key, value => $param }; { key => $key, value => $param };
} }
else { else {
$self->logger->warn( if ($defined) {
"Parameter $key has been rejected by findUserControl") my $warn =
if $defined; "Parameter $key has been rejected by findUserControl: ";
$warn .= $select ? $regex : $self->conf->{findUserControl};
$self->logger->warn($warn);
}
(); ();
} }
} sort keys %{ $self->conf->{findUserSearchingAttributes} }; } sort keys %{ $self->conf->{findUserSearchingAttributes} };

View File

@ -593,9 +593,10 @@ $(window).on 'load', () ->
#$('#formpass').on 'submit', changePwd #$('#formpass').on 'submit', changePwd
$('#resetfinduserform').on 'click', () -> $('.clear-finduser-field').on 'click', () ->
console.log 'Reset form' $(this).parent().find(':input').each ->
$('#finduserForm').trigger('reset') console.log 'Clear search field ->', $(this).attr 'name'
$(this).val ''
$('#closefinduserform').on 'click', () -> $('#closefinduserform').on 'click', () ->
console.log 'Clear modal' console.log 'Clear modal'
@ -616,7 +617,8 @@ $(window).on 'load', () ->
document.body.style.cursor = 'default' document.body.style.cursor = 'default'
user = data.user user = data.user
console.log 'Suggested spoofId=', user console.log 'Suggested spoofId=', user
$('#spoofIdfield').attr 'value', user $("input[name=spoofId]").each ->
$(this).attr 'value', user
$('#captcha').attr 'src', data.captcha if data.captcha $('#captcha').attr 'src', data.captcha if data.captcha
if data.token if data.token
$('#finduserToken').attr 'value', data.token $('#finduserToken').attr 'value', data.token

View File

@ -660,9 +660,11 @@ LemonLDAP::NG Portal jQuery scripts
return $("#confirmpassword").attr('class', 'form-control'); return $("#confirmpassword").attr('class', 'form-control');
} }
}); });
$('#resetfinduserform').on('click', function() { $('.clear-finduser-field').on('click', function() {
console.log('Reset form'); return $(this).parent().find(':input').each(function() {
return $('#finduserForm').trigger('reset'); console.log('Clear search field ->', $(this).attr('name'));
return $(this).val('');
});
}); });
$('#closefinduserform').on('click', function() { $('#closefinduserform').on('click', function() {
console.log('Clear modal'); console.log('Clear modal');
@ -684,7 +686,9 @@ LemonLDAP::NG Portal jQuery scripts
document.body.style.cursor = 'default'; document.body.style.cursor = 'default';
user = data.user; user = data.user;
console.log('Suggested spoofId=', user); console.log('Suggested spoofId=', user);
$('#spoofIdfield').attr('value', user); $("input[name=spoofId]").each(function() {
return $(this).attr('value', user);
});
if (data.captcha) { if (data.captcha) {
$('#captcha').attr('src', data.captcha); $('#captcha').attr('src', data.captcha);
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17,9 +17,9 @@
</TMPL_IF> </TMPL_IF>
<TMPL_LOOP NAME="FIELDS"> <TMPL_LOOP NAME="FIELDS">
<TMPL_IF NAME="select"> <TMPL_IF NAME="select">
<div class="form-group"> <div class="input-group">
<label for="<TMPL_VAR NAME="key">"><TMPL_VAR NAME="value"></label> <select class="custom-select" id="findUser_<TMPL_VAR NAME="key">" name="<TMPL_VAR NAME="key">">
<select class="form-control" id="findUser_<TMPL_VAR NAME="key">" name="<TMPL_VAR NAME="key">"> <option selected><TMPL_VAR NAME="value">...</option>
<TMPL_IF NAME="null"> <TMPL_IF NAME="null">
<option value=""></option> <option value=""></option>
</TMPL_IF> </TMPL_IF>
@ -32,19 +32,19 @@
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><label for="<TMPL_VAR NAME="key">" class="mb-0"><i class="fa fa-binoculars"></i></label></span> <span class="input-group-text"><label for="<TMPL_VAR NAME="key">" class="mb-0"><i class="fa fa-binoculars"></i></label></span>
</div>
<input id="findUser_<TMPL_VAR NAME="key">" name="<TMPL_VAR NAME="key">" type="text" autocomplete="off" class="form-control" placeholder="<TMPL_VAR NAME="value">" /> <input id="findUser_<TMPL_VAR NAME="key">" name="<TMPL_VAR NAME="key">" type="text" autocomplete="off" class="form-control" placeholder="<TMPL_VAR NAME="value">" />
<span class="input-group-text clear-finduser-field"><i class="fa fa-eraser"></i></span>
</div>
</div> </div>
</TMPL_IF> </TMPL_IF>
</TMPL_LOOP> </TMPL_LOOP>
</div> </div>
<div class="modal-footer"> <div class="modal-footer justify-content-between">
<button id="closefinduserform" type="button" class="btn btn-secondary" data-dismiss="modal"><span trspan="close">Close</span></button> <button id="closefinduserform" type="button" class="btn btn-secondary mr-auto" data-dismiss="modal"><span trspan="close">Close</span></button>
<button id="finduserbutton" type="submit" class="btn btn-info" data-dismiss="modal"> <button id="finduserbutton" type="submit" class="btn btn-info" data-dismiss="modal">
<span class="fa fa-search"></span> <span class="fa fa-search"></span>
<span trspan="searchAccount">Search for an account</span> <span trspan="searchAccount">Search for an account</span>
</button> </button>
<button id="resetfinduserform" type="button" class="btn btn-primary"><span trspan="cancel">Cancel</span></button>
</div> </div>
</form> </form>
</div> </div>

View File

@ -37,6 +37,20 @@
</a> </a>
</TMPL_IF> </TMPL_IF>
<TMPL_IF NAME="DISPLAY_UPDATECERTIF">
<a class="btn btn-secondary" href="<TMPL_VAR NAME="MAILCERTIF_URL">?skin=<TMPL_VAR NAME="SKIN"><TMPL_IF NAME="key">&<TMPL_VAR NAME="CHOICE_PARAM">=<TMPL_VAR NAME="key"></TMPL_IF><TMPL_IF NAME="AUTH_URL">&url=<TMPL_VAR NAME="AUTH_URL"></TMPL_IF>">
<span class="fa fa-refresh"></span>
<span trspan="certificateReset">Reset my certificate</span>
</a>
</TMPL_IF>
<TMPL_IF NAME="DISPLAY_FINDUSER">
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#finduserModal">
<span class="fa fa-search"></span>
<span trspan="searchAccount">Search for an account</span>
</button>
</TMPL_IF>
<TMPL_IF NAME="DISPLAY_REGISTER"> <TMPL_IF NAME="DISPLAY_REGISTER">
<a class="btn btn-secondary" href="<TMPL_VAR NAME="REGISTER_URL">?skin=<TMPL_VAR NAME="SKIN"><TMPL_IF NAME="key">&<TMPL_VAR NAME="CHOICE_PARAM">=<TMPL_VAR NAME="key"></TMPL_IF><TMPL_IF NAME="AUTH_URL">&url=<TMPL_VAR NAME="AUTH_URL"></TMPL_IF>"> <a class="btn btn-secondary" href="<TMPL_VAR NAME="REGISTER_URL">?skin=<TMPL_VAR NAME="SKIN"><TMPL_IF NAME="key">&<TMPL_VAR NAME="CHOICE_PARAM">=<TMPL_VAR NAME="key"></TMPL_IF><TMPL_IF NAME="AUTH_URL">&url=<TMPL_VAR NAME="AUTH_URL"></TMPL_IF>">
<span class="fa fa-plus-circle"></span> <span class="fa fa-plus-circle"></span>

View File

@ -3,6 +3,6 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><label for="spoofIdfield" class="mb-0"><i class="fa fa-user icon-blue"></i></label></span> <span class="input-group-text"><label for="spoofIdfield" class="mb-0"><i class="fa fa-user icon-blue"></i></label></span>
</div> </div>
<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="<TMPL_VAR NAME="SPOOFID">" autocomplete="off" trplaceholder="spoofId" aria-required="false"/> <input name="spoofId" type="text" class="form-control" value="<TMPL_VAR NAME="SPOOFID">" autocomplete="off" trplaceholder="spoofId" aria-required="false"/>
</div> </div>
</TMPL_IF> </TMPL_IF>

View File

@ -218,6 +218,14 @@
</button> </button>
</div> </div>
</div> </div>
<TMPL_IF NAME="DISPLAY_FINDUSER">
<div class="actions">
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#finduserModal">
<span class="fa fa-search"></span>
<span trspan="searchAccount">Search for an account</span>
</button>
</div>
</TMPL_IF>
</form> </form>
</div> </div>
</TMPL_IF> </TMPL_IF>

View File

@ -14,3 +14,12 @@
<span trspan="connect">Connect</span> <span trspan="connect">Connect</span>
</button> </button>
</div> </div>
<TMPL_IF NAME="DISPLAY_FINDUSER">
<div class="actions">
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#finduserModal">
<span class="fa fa-search"></span>
<span trspan="searchAccount">Search for an account</span>
</button>
</div>
</TMPL_IF>

View File

@ -18,3 +18,12 @@
<span trspan="connect">Connect</span> <span trspan="connect">Connect</span>
</button> </button>
</div> </div>
<TMPL_IF NAME="DISPLAY_FINDUSER">
<div class="actions">
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#finduserModal">
<span class="fa fa-search"></span>
<span trspan="searchAccount">Search for an account</span>
</button>
</div>
</TMPL_IF>

View File

@ -23,7 +23,7 @@ my $client = LLNG::Manager::Test->new( {
findUser => 1, findUser => 1,
impersonationRule => 1, impersonationRule => 1,
findUserSearchingAttributes => findUserSearchingAttributes =>
{ uid => 'Login', guy => 'Kind', cn => 'Name' }, { 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
findUserExcludingAttributes => findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' }, { type => 'mutant', uid => 'rtyler' },
} }
@ -54,7 +54,7 @@ ok(
); );
ok( ok(
$res->[2]->[0] =~ $res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%, m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""' 'value=""'
) or explain( $res->[2]->[0], 'value=""' ); ) or explain( $res->[2]->[0], 'value=""' );
( $host, $url, $query ) = ( $host, $url, $query ) =

View File

@ -24,7 +24,7 @@ my $client = LLNG::Manager::Test->new( {
findUser => 1, findUser => 1,
impersonationRule => 1, impersonationRule => 1,
findUserSearchingAttributes => findUserSearchingAttributes =>
{ uid => 'Login', guy => 'Kind', cn => 'Name' }, { 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
findUserExcludingAttributes => findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' }, { type => 'mutant', uid => 'rtyler' },
} }

View File

@ -30,7 +30,8 @@ SKIP: {
combination => '[Demo, Demo] or [LDAP, LDAP]', combination => '[Demo, Demo] or [LDAP, LDAP]',
findUser => 1, findUser => 1,
impersonationRule => 1, impersonationRule => 1,
findUserSearchingAttributes => { uid => 'Login', cn => 'Name' }, findUserSearchingAttributes =>
{ 'uid##1' => 'Login', 'cn##1' => 'Name' },
findUserExcludingAttributes => { uid => 'rtyler' }, findUserExcludingAttributes => { uid => 'rtyler' },
} }
} }
@ -56,7 +57,7 @@ SKIP: {
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'cn' ); ( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'cn' );
ok( ok(
$res->[2]->[0] =~ $res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%, m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off" trplaceholder="spoofId" aria-required="false"%,
'value=""' 'value=""'
) or explain( $res->[2]->[0], 'value=""' ); ) or explain( $res->[2]->[0], 'value=""' );

View File

@ -58,10 +58,10 @@ SKIP: {
findUserWildcard => '#', findUserWildcard => '#',
impersonationRule => 1, impersonationRule => 1,
findUserSearchingAttributes => { findUserSearchingAttributes => {
uid => 'Login', 'uid##1' => 'Login',
guy => 'Kind', 'guy##1' => 'Kind',
cn => 'Name', 'cn##1' => 'Name',
room => 'Room' 'room##1' => 'Room'
}, },
findUserExcludingAttributes => findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler # davrosjr # ' }, { type => 'mutant', uid => 'rtyler # davrosjr # ' },
@ -91,7 +91,7 @@ SKIP: {
expectForm( $res, '#', undef, 'uid', 'guy', 'cn', 'room' ); expectForm( $res, '#', undef, 'uid', 'guy', 'cn', 'room' );
ok( ok(
$res->[2]->[0] =~ $res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%, m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""' 'value=""'
) or explain( $res->[2]->[0], 'value=""' ); ) or explain( $res->[2]->[0], 'value=""' );

View File

@ -24,8 +24,11 @@ SKIP: {
captcha_login_enabled => 1, captcha_login_enabled => 1,
findUser => 1, findUser => 1,
impersonationRule => 1, impersonationRule => 1,
findUserSearchingAttributes => findUserSearchingAttributes => {
{ uid => 'Login', guy => 'Kind', cn => 'Name' } 'uid##1' => 'Login',
'guy##1' => 'Kind',
'cn##1' => 'Name'
}
} }
} }
); );

View File

@ -21,10 +21,10 @@ my $client = LLNG::Manager::Test->new( {
findUserControl => '^[\w*\s]+$', findUserControl => '^[\w*\s]+$',
findUserWildcard => '*', findUserWildcard => '*',
findUserSearchingAttributes => { findUserSearchingAttributes => {
uid => 'Name', 'uid##1' => 'Name',
guy => 'Kind', 'guy' => 'Kind',
'type#Type#1' => 'mutant; mutant; character', 'type#Type#1' => 'mutant; mutant; character',
'cn#Name#0' => 'Bad Guy; Not a good person; The Daleks; daleks' 'cn#Name' => 'Bad Guy; Not a good person; The Daleks; daleks'
}, },
findUserExcludingAttributes => findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' }, { type => 'mutant', uid => 'rtyler' },
@ -52,7 +52,7 @@ ok(
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'guy' ); ( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'guy' );
ok( ok(
$res->[2]->[0] =~ $res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%, m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""' 'value=""'
) or explain( $res->[2]->[0], 'value=""' ); ) or explain( $res->[2]->[0], 'value=""' );
@ -84,13 +84,13 @@ m%<input id="findUser_uid" name="uid" type="text" autocomplete="off" class="form
) or explain( $res->[2]->[0], 'id="findUser_uid"' ); ) or explain( $res->[2]->[0], 'id="findUser_uid"' );
ok( ok(
$res->[2]->[0] =~ $res->[2]->[0] =~
m%<select class="form-control" id="findUser_cn" name="cn">%, m%<select class="custom-select" id="findUser_cn" name="cn">%,
'id="findUser_cn"' 'id="findUser_cn"'
) or explain( $res->[2]->[0], 'id="findUser_cn"' ); ) or explain( $res->[2]->[0], 'id="findUser_cn"' );
ok( $res->[2]->[0] !~ m%id="findUser_type"%, 'id="findUser_type" not found' ) ok( $res->[2]->[0] !~ m%id="findUser_type"%, 'id="findUser_type" not found' )
or explain( $res->[2]->[0], 'id="findUser_cn" not found' ); or explain( $res->[2]->[0], 'id="findUser_type" not found' );
ok( $res->[2]->[0] =~ m%<label for="cn">Name</label>%, 'label for="cn"' ) ok( $res->[2]->[0] =~ m%<option selected>Name...</option>%, 'Name...' )
or explain( $res->[2]->[0], 'label for="cn"' ); or explain( $res->[2]->[0], 'Name...' );
ok( $res->[2]->[0] !~ m%<option value=""></option>%, 'Empty option not found' ) ok( $res->[2]->[0] !~ m%<option value=""></option>%, 'Empty option not found' )
or explain( $res->[2]->[0], 'Empty option not found' ); or explain( $res->[2]->[0], 'Empty option not found' );
ok( $res->[2]->[0] =~ m%<option value="The Daleks">daleks</option>%, ok( $res->[2]->[0] =~ m%<option value="The Daleks">daleks</option>%,
@ -100,7 +100,7 @@ ok( $res->[2]->[0] =~ m%<option value="Bad Guy">Not a good person</option>%,
'Bad Guy option' ) 'Bad Guy option' )
or explain( $res->[2]->[0], 'Bad Guy' ); or explain( $res->[2]->[0], 'Bad Guy' );
$request = 'cn=Bad Guy'; $request = 'cn=Bad Guy&guy=bad';
ok( ok(
$res = $client->_post( $res = $client->_post(
'/finduser', IO::String->new($request), '/finduser', IO::String->new($request),
@ -114,7 +114,7 @@ ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
ok( $json->{user} eq 'davros', ' Good user' ) ok( $json->{user} eq 'davros', ' Good user' )
or explain( $json, 'user => davros' ); or explain( $json, 'user => davros' );
$request = 'cn=The Daleks'; $request = 'cn=The Daleks&guy=bad';
ok( ok(
$res = $client->_post( $res = $client->_post(
'/finduser', IO::String->new($request), '/finduser', IO::String->new($request),
@ -130,7 +130,7 @@ ok( $json->{result} == 0, ' Good result' )
ok( $json->{error} == PE_USERNOTFOUND, ' No user found' ) ok( $json->{error} == PE_USERNOTFOUND, ' No user found' )
or explain( $json, 'error => 4' ); or explain( $json, 'error => 4' );
$request = 'uid=davros'; $request = 'uid=davros&guy=bad';
ok( ok(
$res = $client->_post( $res = $client->_post(
'/finduser', IO::String->new($request), '/finduser', IO::String->new($request),

View File

@ -17,7 +17,7 @@ my $client = LLNG::Manager::Test->new( {
findUser => 1, findUser => 1,
impersonationRule => 1, impersonationRule => 1,
findUserSearchingAttributes => findUserSearchingAttributes =>
{ uid => 'Login', guy => 'Kind', cn => 'Name' }, { 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
findUserExcludingAttributes => findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' }, { type => 'mutant', uid => 'rtyler' },
} }

View File

@ -22,8 +22,8 @@ my $client = LLNG::Manager::Test->new( {
findUserControl => '^[\w*\s]+$', findUserControl => '^[\w*\s]+$',
findUserWildcard => '*', findUserWildcard => '*',
findUserSearchingAttributes => { findUserSearchingAttributes => {
uid => undef, 'uid#fdgd#1' => undef,
guy => 'Kind', 'guy##1' => 'Kind',
'cn#Name#1' => 'Bad Guy; Not a good person; BB; Bad Boy' 'cn#Name#1' => 'Bad Guy; Not a good person; BB; Bad Boy'
}, },
findUserExcludingAttributes => findUserExcludingAttributes =>
@ -52,7 +52,7 @@ ok(
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'guy' ); ( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'guy' );
ok( ok(
$res->[2]->[0] =~ $res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%, m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""' 'value=""'
) or explain( $res->[2]->[0], 'value=""' ); ) or explain( $res->[2]->[0], 'value=""' );
@ -84,11 +84,11 @@ m%<input id="findUser_uid" name="uid" type="text" autocomplete="off" class="form
) or explain( $res->[2]->[0], 'id="findUser_uid"' ); ) or explain( $res->[2]->[0], 'id="findUser_uid"' );
ok( ok(
$res->[2]->[0] =~ $res->[2]->[0] =~
m%<select class="form-control" id="findUser_cn" name="cn">%, m%<select class="custom-select" id="findUser_cn" name="cn">%,
'id="findUser_cn"' 'id="findUser_cn"'
) or explain( $res->[2]->[0], 'id="findUser_cn"' ); ) or explain( $res->[2]->[0], 'id="findUser_cn"' );
ok( $res->[2]->[0] =~ m%<label for="cn">Name</label>%, 'label for="cn"' ) ok( $res->[2]->[0] =~ m%<option selected>Name...</option>%, 'Name...' )
or explain( $res->[2]->[0], 'label for="cn"' ); or explain( $res->[2]->[0], 'Name...' );
ok( $res->[2]->[0] =~ m%<option value=""></option>%, 'Empty option' ) ok( $res->[2]->[0] =~ m%<option value=""></option>%, 'Empty option' )
or explain( $res->[2]->[0], 'Empty option' ); or explain( $res->[2]->[0], 'Empty option' );
ok( $res->[2]->[0] =~ m%<option value="BB">Bad Boy</option>%, 'BB option' ) ok( $res->[2]->[0] =~ m%<option value="BB">Bad Boy</option>%, 'BB option' )

View File

@ -37,8 +37,11 @@ SKIP: {
impersonationRule => 1, impersonationRule => 1,
findUserWildcard => '#', findUserWildcard => '#',
findUserControl => '^[\w#\s]+$', findUserControl => '^[\w#\s]+$',
findUserSearchingAttributes => findUserSearchingAttributes => {
{ uid => 'Login', roomNumber => 'Room', cn => 'Name' }, 'uid##1' => 'Login',
'roomNumber##1' => 'Room',
'cn##1' => 'Name'
},
findUserExcludingAttributes => findUserExcludingAttributes =>
{ mail => 'french@badwolf.org', uid => 'russian' }, { mail => 'french@badwolf.org', uid => 'russian' },
} }
@ -66,7 +69,7 @@ SKIP: {
expectForm( $res, '#', undef, 'uid', 'roomNumber', 'cn' ); expectForm( $res, '#', undef, 'uid', 'roomNumber', 'cn' );
ok( ok(
$res->[2]->[0] =~ $res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%, m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""' 'value=""'
) or explain( $res->[2]->[0], 'value=""' ); ) or explain( $res->[2]->[0], 'value=""' );

View File

@ -87,7 +87,7 @@ my $client = LLNG::Manager::Test->new( {
impersonationRule => 1, impersonationRule => 1,
useSafeJail => 1, useSafeJail => 1,
findUserSearchingAttributes => findUserSearchingAttributes =>
{ uid => 'Login', guy => 'Kind', cn => 'Name' }, { 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
findUserExcludingAttributes => findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' }, { type => 'mutant', uid => 'rtyler' },
} }

View File

@ -23,7 +23,7 @@ my $client = LLNG::Manager::Test->new( {
findUserControl => '^[\w*\s]+$', findUserControl => '^[\w*\s]+$',
findUserWildcard => '*', findUserWildcard => '*',
findUserSearchingAttributes => { findUserSearchingAttributes => {
uid => 'User', 'uid##1' => 'User',
}, },
authChoiceModules => { authChoiceModules => {
strong => 'Apache;Demo;Null;;;{}', strong => 'Apache;Demo;Null;;;{}',
@ -63,7 +63,7 @@ ok(
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid' ); ( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid' );
ok( ok(
$res->[2]->[0] =~ $res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%, m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""' 'value=""'
) or explain( $res->[2]->[0], 'value=""' ); ) or explain( $res->[2]->[0], 'value=""' );
ok( ok(

View File

@ -19,7 +19,7 @@ my $client = LLNG::Manager::Test->new( {
findUser => 1, findUser => 1,
impersonationRule => 0, impersonationRule => 0,
findUserSearchingAttributes => findUserSearchingAttributes =>
{ uid => 'Login', guy => 'Kind', cn => 'Name' }, { 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
findUserExcludingAttributes => findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' }, { type => 'mutant', uid => 'rtyler' },
} }