Merge branch '2589' into 'v2.0'
2589 See merge request lemonldap-ng/lemonldap-ng!215
This commit is contained in:
commit
57372ba5b7
|
@ -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.
|
||||
- **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::
|
||||
|
||||
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.
|
||||
|
||||
.. attention::
|
||||
|
||||
LDAP filter works only if an objectClass is set.
|
||||
|
||||
.. attention::
|
||||
|
||||
Searching request is built based on provided parameters value depending on users backend like this:
|
||||
|
@ -52,9 +55,4 @@ Just enable it in the Manager (section “plugins”). Then, set searching attri
|
|||
|
||||
.. danger::
|
||||
|
||||
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
|
||||
With AuthChoice, you must set which module will be called by this plugin (:doc:`Backend choice by users<authchoice>`).
|
|
@ -710,7 +710,7 @@ t/68-FindUser-with-Choice-and-token.t
|
|||
t/68-FindUser-with-Combination.t
|
||||
t/68-FindUser-with-DBI.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.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.t
|
||||
t/90-Translations.t
|
||||
t/91-handler-cache-cleaned.t
|
||||
t/91-Handler-cache-cleaned.t
|
||||
t/91-Memory-Leak.t
|
||||
t/99-Dont-load-Dumper.t
|
||||
t/99-pod.t
|
||||
|
|
|
@ -13,7 +13,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
|
|||
|
||||
extends 'Lemonldap::NG::Common::Module';
|
||||
|
||||
our $VERSION = '2.0.12';
|
||||
our $VERSION = '2.0.13';
|
||||
|
||||
# PROPERTIES
|
||||
|
||||
|
@ -76,8 +76,7 @@ has findUserFilter => (
|
|||
is => 'ro',
|
||||
lazy => 1,
|
||||
builder => sub {
|
||||
|
||||
# $_[0]->conf->{AuthLDAPFilter} ||
|
||||
$_[0]->conf->{AuthLDAPFilter} ||
|
||||
$_[0]->conf->{LDAPFilter}
|
||||
|| '(&(uid=$user)(objectClass=inetOrgPerson))';
|
||||
}
|
||||
|
@ -180,8 +179,10 @@ sub findUser {
|
|||
$self->validateLdap;
|
||||
return PE_LDAPCONNECTFAILED unless $self->ldap;
|
||||
|
||||
$self->findUserFilter =~ /\bobjectClass=(\w+)\b/;
|
||||
my $filter = "(&(objectClass=$1)";
|
||||
my $filter =
|
||||
$self->findUserFilter =~ /\bobjectClass=(\w+)\b/
|
||||
? "(&(objectClass=$1)"
|
||||
: '(&';
|
||||
my $wildcard = $self->conf->{findUserWildcard};
|
||||
$self->logger->info("LDAP UserDB with wildcard ($wildcard)") if $wildcard;
|
||||
foreach (@$searching) {
|
||||
|
@ -199,11 +200,12 @@ sub findUser {
|
|||
|
||||
$self->bind();
|
||||
my $mesg = $self->ldap->search(
|
||||
base => $self->conf->{ldapBase},
|
||||
scope => 'sub',
|
||||
filter => $filter,
|
||||
deref => $self->conf->{ldapSearchDeref} || 'find',
|
||||
attrs => $self->attrs,
|
||||
base => $self->conf->{ldapBase},
|
||||
scope => 'sub',
|
||||
filter => $filter,
|
||||
deref => $self->conf->{ldapSearchDeref} || 'find',
|
||||
attrs => $self->attrs,
|
||||
sizelimit => 50
|
||||
);
|
||||
|
||||
if ( $mesg->code() != 0 ) {
|
||||
|
@ -218,9 +220,10 @@ sub findUser {
|
|||
my $rank = int( rand( $mesg->count() ) );
|
||||
$self->logger->debug("Demo UserDB random rank: $rank");
|
||||
my $entry =
|
||||
( $mesg->entry($rank)->dn() =~ /\b(?:uid|sAMAccountName)=(\w+?)\b/ )
|
||||
[0];
|
||||
$self->userLogger->info("FindUser: LDAP UserDB returns $entry");
|
||||
( $mesg->entry($rank)->dn() =~ /\b(?:uid|sAMAccountName)\x3d(.+?),/ )
|
||||
[0] || '';
|
||||
$self->userLogger->info("FindUser: LDAP UserDB returns $entry")
|
||||
if $entry;
|
||||
$req->data->{findUser} = $entry;
|
||||
return PE_OK;
|
||||
}
|
||||
|
|
|
@ -479,7 +479,6 @@ sub display {
|
|||
MSG => $req->info(),
|
||||
LOCKTIME => $req->lockTime(),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
# 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 {
|
||||
|
||||
my $displayType =
|
||||
eval { $self->_authentication->getDisplayType($req) }
|
||||
|| 'logo';
|
||||
|
|
|
@ -9,7 +9,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
|
|||
PE_TOKENEXPIRED
|
||||
);
|
||||
|
||||
our $VERSION = '2.0.12';
|
||||
our $VERSION = '2.0.13';
|
||||
|
||||
extends qw(
|
||||
Lemonldap::NG::Portal::Main::Plugin
|
||||
|
@ -32,8 +32,10 @@ sub init {
|
|||
my ($self) = @_;
|
||||
( my $imp = grep /::Plugins::Impersonation$/, $self->p->enabledPlugins )
|
||||
? $self->addUnauthRoute( finduser => 'provideUser', ['POST'] )
|
||||
->addAuthRoute( finduser => 'provideUser',
|
||||
['POST'] ) # Allow findUser with reAuth
|
||||
->addAuthRoute(
|
||||
finduser => 'provideUser',
|
||||
['POST']
|
||||
) # Allow findUser with reAuth
|
||||
: $self->logger->warn('FindUser plugin enabled without Impersonation');
|
||||
$self->logger->warn('FindUser plugin enabled without searching attribute')
|
||||
unless keys %{ $self->conf->{findUserSearchingAttributes} };
|
||||
|
@ -87,19 +89,22 @@ sub retreiveFindUserParams {
|
|||
my $regex = '^(?:' . join( '|', keys %values ) . ')$';
|
||||
my $checked =
|
||||
$select
|
||||
? $param =~ /$regex/o
|
||||
: $param =~ /$self->{conf}->{findUserControl}/o;
|
||||
push @required, $key if $select && !$null;
|
||||
? $param =~ /$regex/
|
||||
: $param =~ /$self->{conf}->{findUserControl}/;
|
||||
push @required, $key unless $null;
|
||||
|
||||
# For <select>, accept only set values or empty if allowed
|
||||
if ( $defined && $checked ) {
|
||||
$self->logger->debug("Append searching parameter: $key => $param");
|
||||
$self->logger->debug("Append searching parameter: $key => $param");
|
||||
{ key => $key, value => $param };
|
||||
}
|
||||
else {
|
||||
$self->logger->warn(
|
||||
"Parameter $key has been rejected by findUserControl")
|
||||
if $defined;
|
||||
if ($defined) {
|
||||
my $warn =
|
||||
"Parameter $key has been rejected by findUserControl: ";
|
||||
$warn .= $select ? $regex : $self->conf->{findUserControl};
|
||||
$self->logger->warn($warn);
|
||||
}
|
||||
();
|
||||
}
|
||||
} sort keys %{ $self->conf->{findUserSearchingAttributes} };
|
||||
|
|
|
@ -593,9 +593,10 @@ $(window).on 'load', () ->
|
|||
|
||||
#$('#formpass').on 'submit', changePwd
|
||||
|
||||
$('#resetfinduserform').on 'click', () ->
|
||||
console.log 'Reset form'
|
||||
$('#finduserForm').trigger('reset')
|
||||
$('.clear-finduser-field').on 'click', () ->
|
||||
$(this).parent().find(':input').each ->
|
||||
console.log 'Clear search field ->', $(this).attr 'name'
|
||||
$(this).val ''
|
||||
|
||||
$('#closefinduserform').on 'click', () ->
|
||||
console.log 'Clear modal'
|
||||
|
@ -616,7 +617,8 @@ $(window).on 'load', () ->
|
|||
document.body.style.cursor = 'default'
|
||||
user = data.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
|
||||
if data.token
|
||||
$('#finduserToken').attr 'value', data.token
|
||||
|
|
|
@ -660,9 +660,11 @@ LemonLDAP::NG Portal jQuery scripts
|
|||
return $("#confirmpassword").attr('class', 'form-control');
|
||||
}
|
||||
});
|
||||
$('#resetfinduserform').on('click', function() {
|
||||
console.log('Reset form');
|
||||
return $('#finduserForm').trigger('reset');
|
||||
$('.clear-finduser-field').on('click', function() {
|
||||
return $(this).parent().find(':input').each(function() {
|
||||
console.log('Clear search field ->', $(this).attr('name'));
|
||||
return $(this).val('');
|
||||
});
|
||||
});
|
||||
$('#closefinduserform').on('click', function() {
|
||||
console.log('Clear modal');
|
||||
|
@ -684,7 +686,9 @@ LemonLDAP::NG Portal jQuery scripts
|
|||
document.body.style.cursor = 'default';
|
||||
user = data.user;
|
||||
console.log('Suggested spoofId=', user);
|
||||
$('#spoofIdfield').attr('value', user);
|
||||
$("input[name=spoofId]").each(function() {
|
||||
return $(this).attr('value', user);
|
||||
});
|
||||
if (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
|
@ -17,34 +17,34 @@
|
|||
</TMPL_IF>
|
||||
<TMPL_LOOP NAME="FIELDS">
|
||||
<TMPL_IF NAME="select">
|
||||
<div class="form-group">
|
||||
<label for="<TMPL_VAR NAME="key">"><TMPL_VAR NAME="value"></label>
|
||||
<select class="form-control" id="findUser_<TMPL_VAR NAME="key">" name="<TMPL_VAR NAME="key">">
|
||||
<TMPL_IF NAME="null">
|
||||
<option value=""></option>
|
||||
</TMPL_IF>
|
||||
<TMPL_LOOP NAME="choices">
|
||||
<option value="<TMPL_VAR NAME="key">"><TMPL_VAR NAME="value"></option>
|
||||
</TMPL_LOOP>
|
||||
</select>
|
||||
<div class="input-group">
|
||||
<select class="custom-select" id="findUser_<TMPL_VAR NAME="key">" name="<TMPL_VAR NAME="key">">
|
||||
<option selected><TMPL_VAR NAME="value">...</option>
|
||||
<TMPL_IF NAME="null">
|
||||
<option value=""></option>
|
||||
</TMPL_IF>
|
||||
<TMPL_LOOP NAME="choices">
|
||||
<option value="<TMPL_VAR NAME="key">"><TMPL_VAR NAME="value"></option>
|
||||
</TMPL_LOOP>
|
||||
</select>
|
||||
</div>
|
||||
<TMPL_ELSE>
|
||||
<div class="input-group mb-3">
|
||||
<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>
|
||||
<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>
|
||||
<input id="findUser_<TMPL_VAR NAME="key">" name="<TMPL_VAR NAME="key">" type="text" autocomplete="off" class="form-control" placeholder="<TMPL_VAR NAME="value">" />
|
||||
</div>
|
||||
</TMPL_IF>
|
||||
</TMPL_LOOP>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="closefinduserform" type="button" class="btn btn-secondary" data-dismiss="modal"><span trspan="close">Close</span></button>
|
||||
<div class="modal-footer justify-content-between">
|
||||
<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">
|
||||
<span class="fa fa-search"></span>
|
||||
<span trspan="searchAccount">Search for an account</span>
|
||||
</button>
|
||||
<button id="resetfinduserform" type="button" class="btn btn-primary"><span trspan="cancel">Cancel</span></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -37,10 +37,24 @@
|
|||
</a>
|
||||
</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">
|
||||
<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 trspan="createAccount">Create an account</span>
|
||||
</a>
|
||||
<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 trspan="createAccount">Create an account</span>
|
||||
</a>
|
||||
</TMPL_IF>
|
||||
</div>
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
<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>
|
||||
</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>
|
||||
</TMPL_IF>
|
||||
|
|
|
@ -218,6 +218,14 @@
|
|||
</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>
|
||||
</form>
|
||||
</div>
|
||||
</TMPL_IF>
|
||||
|
|
|
@ -14,3 +14,12 @@
|
|||
<span trspan="connect">Connect</span>
|
||||
</button>
|
||||
</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>
|
|
@ -18,3 +18,12 @@
|
|||
<span trspan="connect">Connect</span>
|
||||
</button>
|
||||
</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>
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<span class="fa fa-refresh"></span>
|
||||
<span trspan="certificateReset">Reset my certificate</span>
|
||||
</a>
|
||||
</TMPL_IF>
|
||||
</TMPL_IF>
|
||||
|
||||
<TMPL_IF NAME="DISPLAY_FINDUSER">
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#finduserModal">
|
||||
|
|
|
@ -18,12 +18,12 @@ my $client = LLNG::Manager::Test->new( {
|
|||
'2_ssl' => 'SSL;Demo;Null',
|
||||
},
|
||||
authChoiceFindUser => '1_dem',
|
||||
useSafeJail => 1,
|
||||
requireToken => 1,
|
||||
findUser => 1,
|
||||
impersonationRule => 1,
|
||||
useSafeJail => 1,
|
||||
requireToken => 1,
|
||||
findUser => 1,
|
||||
impersonationRule => 1,
|
||||
findUserSearchingAttributes =>
|
||||
{ uid => 'Login', guy => 'Kind', cn => 'Name' },
|
||||
{ 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
|
||||
findUserExcludingAttributes =>
|
||||
{ type => 'mutant', uid => 'rtyler' },
|
||||
}
|
||||
|
@ -53,12 +53,12 @@ ok(
|
|||
'Post FindUser request'
|
||||
);
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
|
||||
'value=""'
|
||||
) or explain( $res->[2]->[0], 'value=""' );
|
||||
$res->[2]->[0] =~
|
||||
m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
|
||||
'value=""'
|
||||
) or explain( $res->[2]->[0], 'value=""' );
|
||||
( $host, $url, $query ) =
|
||||
expectForm( $res, '#', undef, 'uid', 'guy', 'cn', 'token' );
|
||||
expectForm( $res, '#', undef, 'uid', 'guy', 'cn', 'token' );
|
||||
$query =~ s/user=/user=rtyler/;
|
||||
$query =~ s/password=/password=rtyler/;
|
||||
$query =~ s/2_ssl/1_demo/;
|
||||
|
|
|
@ -24,7 +24,7 @@ my $client = LLNG::Manager::Test->new( {
|
|||
findUser => 1,
|
||||
impersonationRule => 1,
|
||||
findUserSearchingAttributes =>
|
||||
{ uid => 'Login', guy => 'Kind', cn => 'Name' },
|
||||
{ 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
|
||||
findUserExcludingAttributes =>
|
||||
{ type => 'mutant', uid => 'rtyler' },
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
|
|||
or print STDERR "$@\n" . Dumper($res);
|
||||
ok( $json->{user} eq 'dwho', ' Good user' )
|
||||
or explain( $json, 'user => dwho' );
|
||||
ok( $token = $json->{token}, 'Found token' );
|
||||
ok( $token = $json->{token}, 'Found token' );
|
||||
count(4);
|
||||
|
||||
ok( $res = $client->_get( '/', accept => 'text/html' ), 'Get Portal', );
|
||||
|
@ -79,7 +79,7 @@ ok( $json->{error} == 82, ' Token expired' )
|
|||
or explain( $json, 'Token expired' );
|
||||
ok( $json->{result} == 0, ' result => 0' )
|
||||
or explain( $json, 'Result => 0' );
|
||||
ok( $token = $json->{token}, 'Found token' );
|
||||
ok( $token = $json->{token}, 'Found token' );
|
||||
count(6);
|
||||
|
||||
clean_sessions();
|
||||
|
|
|
@ -27,10 +27,11 @@ SKIP: {
|
|||
'LDAP' => { 'for' => 0, 'type' => 'LDAP' },
|
||||
'Demo' => { 'for' => 0, 'type' => 'Demo' }
|
||||
},
|
||||
combination => '[Demo, Demo] or [LDAP, LDAP]',
|
||||
findUser => 1,
|
||||
impersonationRule => 1,
|
||||
findUserSearchingAttributes => { uid => 'Login', cn => 'Name' },
|
||||
combination => '[Demo, Demo] or [LDAP, LDAP]',
|
||||
findUser => 1,
|
||||
impersonationRule => 1,
|
||||
findUserSearchingAttributes =>
|
||||
{ 'uid##1' => 'Login', 'cn##1' => 'Name' },
|
||||
findUserExcludingAttributes => { uid => 'rtyler' },
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +57,7 @@ SKIP: {
|
|||
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'cn' );
|
||||
ok(
|
||||
$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=""'
|
||||
) or explain( $res->[2]->[0], 'value=""' );
|
||||
|
||||
|
|
|
@ -58,10 +58,10 @@ SKIP: {
|
|||
findUserWildcard => '#',
|
||||
impersonationRule => 1,
|
||||
findUserSearchingAttributes => {
|
||||
uid => 'Login',
|
||||
guy => 'Kind',
|
||||
cn => 'Name',
|
||||
room => 'Room'
|
||||
'uid##1' => 'Login',
|
||||
'guy##1' => 'Kind',
|
||||
'cn##1' => 'Name',
|
||||
'room##1' => 'Room'
|
||||
},
|
||||
findUserExcludingAttributes =>
|
||||
{ type => 'mutant', uid => 'rtyler # davrosjr # ' },
|
||||
|
@ -91,7 +91,7 @@ SKIP: {
|
|||
expectForm( $res, '#', undef, 'uid', 'guy', 'cn', 'room' );
|
||||
ok(
|
||||
$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=""'
|
||||
) or explain( $res->[2]->[0], 'value=""' );
|
||||
|
||||
|
|
|
@ -17,15 +17,18 @@ SKIP: {
|
|||
}
|
||||
my $client = LLNG::Manager::Test->new( {
|
||||
ini => {
|
||||
logLevel => 'error',
|
||||
authentication => 'Demo',
|
||||
userDB => 'Same',
|
||||
useSafeJail => 1,
|
||||
captcha_login_enabled => 1,
|
||||
findUser => 1,
|
||||
impersonationRule => 1,
|
||||
findUserSearchingAttributes =>
|
||||
{ uid => 'Login', guy => 'Kind', cn => 'Name' }
|
||||
logLevel => 'error',
|
||||
authentication => 'Demo',
|
||||
userDB => 'Same',
|
||||
useSafeJail => 1,
|
||||
captcha_login_enabled => 1,
|
||||
findUser => 1,
|
||||
impersonationRule => 1,
|
||||
findUserSearchingAttributes => {
|
||||
'uid##1' => 'Login',
|
||||
'guy##1' => 'Kind',
|
||||
'cn##1' => 'Name'
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -21,10 +21,10 @@ my $client = LLNG::Manager::Test->new( {
|
|||
findUserControl => '^[\w*\s]+$',
|
||||
findUserWildcard => '*',
|
||||
findUserSearchingAttributes => {
|
||||
uid => 'Name',
|
||||
guy => 'Kind',
|
||||
'uid##1' => 'Name',
|
||||
'guy' => 'Kind',
|
||||
'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 =>
|
||||
{ type => 'mutant', uid => 'rtyler' },
|
||||
|
@ -52,7 +52,7 @@ ok(
|
|||
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'guy' );
|
||||
ok(
|
||||
$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=""'
|
||||
) 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"' );
|
||||
ok(
|
||||
$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"'
|
||||
) or explain( $res->[2]->[0], 'id="findUser_cn"' );
|
||||
ok( $res->[2]->[0] !~ m%id="findUser_type"%, 'id="findUser_type" not found' )
|
||||
or explain( $res->[2]->[0], 'id="findUser_cn" not found' );
|
||||
ok( $res->[2]->[0] =~ m%<label for="cn">Name</label>%, 'label for="cn"' )
|
||||
or explain( $res->[2]->[0], 'label for="cn"' );
|
||||
or explain( $res->[2]->[0], 'id="findUser_type" not found' );
|
||||
ok( $res->[2]->[0] =~ m%<option selected>Name...</option>%, 'Name...' )
|
||||
or explain( $res->[2]->[0], 'Name...' );
|
||||
ok( $res->[2]->[0] !~ m%<option value=""></option>%, 'Empty option not found' )
|
||||
or explain( $res->[2]->[0], 'Empty option not found' );
|
||||
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' )
|
||||
or explain( $res->[2]->[0], 'Bad Guy' );
|
||||
|
||||
$request = 'cn=Bad Guy';
|
||||
$request = 'cn=Bad Guy&guy=bad';
|
||||
ok(
|
||||
$res = $client->_post(
|
||||
'/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' )
|
||||
or explain( $json, 'user => davros' );
|
||||
|
||||
$request = 'cn=The Daleks';
|
||||
$request = 'cn=The Daleks&guy=bad';
|
||||
ok(
|
||||
$res = $client->_post(
|
||||
'/finduser', IO::String->new($request),
|
||||
|
@ -130,7 +130,7 @@ ok( $json->{result} == 0, ' Good result' )
|
|||
ok( $json->{error} == PE_USERNOTFOUND, ' No user found' )
|
||||
or explain( $json, 'error => 4' );
|
||||
|
||||
$request = 'uid=davros';
|
||||
$request = 'uid=davros&guy=bad';
|
||||
ok(
|
||||
$res = $client->_post(
|
||||
'/finduser', IO::String->new($request),
|
|
@ -17,7 +17,7 @@ my $client = LLNG::Manager::Test->new( {
|
|||
findUser => 1,
|
||||
impersonationRule => 1,
|
||||
findUserSearchingAttributes =>
|
||||
{ uid => 'Login', guy => 'Kind', cn => 'Name' },
|
||||
{ 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
|
||||
findUserExcludingAttributes =>
|
||||
{ type => 'mutant', uid => 'rtyler' },
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ my $client = LLNG::Manager::Test->new( {
|
|||
findUserControl => '^[\w*\s]+$',
|
||||
findUserWildcard => '*',
|
||||
findUserSearchingAttributes => {
|
||||
uid => undef,
|
||||
guy => 'Kind',
|
||||
'cn#Name#1' => 'Bad Guy; Not a good person; BB; Bad Boy'
|
||||
'uid#fdgd#1' => undef,
|
||||
'guy##1' => 'Kind',
|
||||
'cn#Name#1' => 'Bad Guy; Not a good person; BB; Bad Boy'
|
||||
},
|
||||
findUserExcludingAttributes =>
|
||||
{ type => 'mutant', uid => 'rtyler' },
|
||||
|
@ -52,7 +52,7 @@ ok(
|
|||
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'guy' );
|
||||
ok(
|
||||
$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=""'
|
||||
) 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"' );
|
||||
ok(
|
||||
$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"'
|
||||
) or explain( $res->[2]->[0], 'id="findUser_cn"' );
|
||||
ok( $res->[2]->[0] =~ m%<label for="cn">Name</label>%, 'label for="cn"' )
|
||||
or explain( $res->[2]->[0], 'label for="cn"' );
|
||||
ok( $res->[2]->[0] =~ m%<option selected>Name...</option>%, 'Name...' )
|
||||
or explain( $res->[2]->[0], 'Name...' );
|
||||
ok( $res->[2]->[0] =~ m%<option value=""></option>%, 'Empty option' )
|
||||
or explain( $res->[2]->[0], 'Empty option' );
|
||||
ok( $res->[2]->[0] =~ m%<option value="BB">Bad Boy</option>%, 'BB option' )
|
||||
|
|
|
@ -32,13 +32,16 @@ SKIP: {
|
|||
roomNumber => 'roomNumber',
|
||||
mail => 'mail'
|
||||
},
|
||||
requireToken => 0,
|
||||
findUser => 1,
|
||||
impersonationRule => 1,
|
||||
findUserWildcard => '#',
|
||||
findUserControl => '^[\w#\s]+$',
|
||||
findUserSearchingAttributes =>
|
||||
{ uid => 'Login', roomNumber => 'Room', cn => 'Name' },
|
||||
requireToken => 0,
|
||||
findUser => 1,
|
||||
impersonationRule => 1,
|
||||
findUserWildcard => '#',
|
||||
findUserControl => '^[\w#\s]+$',
|
||||
findUserSearchingAttributes => {
|
||||
'uid##1' => 'Login',
|
||||
'roomNumber##1' => 'Room',
|
||||
'cn##1' => 'Name'
|
||||
},
|
||||
findUserExcludingAttributes =>
|
||||
{ mail => 'french@badwolf.org', uid => 'russian' },
|
||||
}
|
||||
|
@ -66,7 +69,7 @@ SKIP: {
|
|||
expectForm( $res, '#', undef, 'uid', 'roomNumber', 'cn' );
|
||||
ok(
|
||||
$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=""'
|
||||
) or explain( $res->[2]->[0], 'value=""' );
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ my $client = LLNG::Manager::Test->new( {
|
|||
impersonationRule => 1,
|
||||
useSafeJail => 1,
|
||||
findUserSearchingAttributes =>
|
||||
{ uid => 'Login', guy => 'Kind', cn => 'Name' },
|
||||
{ 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
|
||||
findUserExcludingAttributes =>
|
||||
{ type => 'mutant', uid => 'rtyler' },
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ my $client = LLNG::Manager::Test->new( {
|
|||
findUserControl => '^[\w*\s]+$',
|
||||
findUserWildcard => '*',
|
||||
findUserSearchingAttributes => {
|
||||
uid => 'User',
|
||||
'uid##1' => 'User',
|
||||
},
|
||||
authChoiceModules => {
|
||||
strong => 'Apache;Demo;Null;;;{}',
|
||||
|
@ -63,7 +63,7 @@ ok(
|
|||
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid' );
|
||||
ok(
|
||||
$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=""'
|
||||
) or explain( $res->[2]->[0], 'value=""' );
|
||||
ok(
|
||||
|
|
|
@ -19,7 +19,7 @@ my $client = LLNG::Manager::Test->new( {
|
|||
findUser => 1,
|
||||
impersonationRule => 0,
|
||||
findUserSearchingAttributes =>
|
||||
{ uid => 'Login', guy => 'Kind', cn => 'Name' },
|
||||
{ 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
|
||||
findUserExcludingAttributes =>
|
||||
{ type => 'mutant', uid => 'rtyler' },
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user