Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
lemonldap-ng
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maxime Besson
lemonldap-ng
Commits
772b82cd
Commit
772b82cd
authored
Mar 11, 2019
by
Christophe Maudoux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve unit test (
#1664
)
parent
d39078f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
2 deletions
+63
-2
lemonldap-ng-portal/t/67-CheckUser.t
lemonldap-ng-portal/t/67-CheckUser.t
+1
-1
lemonldap-ng-portal/t/68-Impersonation.t
lemonldap-ng-portal/t/68-Impersonation.t
+61
-0
lemonldap-ng-portal/t/lmConf-1.json
lemonldap-ng-portal/t/lmConf-1.json
+1
-1
No files found.
lemonldap-ng-portal/t/67-CheckUser.t
View file @
772b82cd
...
...
@@ -29,7 +29,7 @@ my $client = LLNG::Manager::Test->new( {
ok
(
$res
=
$client
->
_post
(
'
/
',
IO::
String
->
new
('
user=
msmith&password=msmith
'),
IO::
String
->
new
('
user=
rtyler&password=rtyler
'),
length
=>
27
,
accept
=>
'
text/html
',
),
...
...
lemonldap-ng-portal/t/68-Impersonation.t
View file @
772b82cd
...
...
@@ -113,6 +113,67 @@ count(2);
$id
=
expectCookie
(
$res
);
$client
->
logout
(
$id
);
## An unauthorized user to impersonate tries to authenticate
ok
(
$res
=
$client
->
_get
(
'
/
',
accept
=>
'
text/html
'
),
'
Get Menu
',
);
count
(
1
);
(
$host
,
$url
,
$query
)
=
expectForm
(
$res
,
'
#
',
undef
,
'
user
',
'
password
',
'
spoofId
'
);
$query
=~
s/user=/user=msmith/
;
$query
=~
s/password=/password=msmith/
;
ok
(
$res
=
$client
->
_post
(
'
/
',
IO::
String
->
new
(
$query
),
length
=>
length
(
$query
),
accept
=>
'
text/html
',
),
'
Auth query
'
);
count
(
1
);
$id
=
expectCookie
(
$res
);
expectRedirection
(
$res
,
'
http://auth.example.com/
'
);
# CheckUser form
# ------------------------
ok
(
$res
=
$client
->
_get
(
'
/checkuser
',
cookie
=>
"
lemonldap=
$id
",
accept
=>
'
text/html
'
),
'
CheckUser form
',
);
count
(
1
);
(
$host
,
$url
,
$query
)
=
expectForm
(
$res
,
undef
,
'
/checkuser
',
'
user
',
'
url
'
);
ok
(
$res
->
[
2
]
->
[
0
]
=~
m%<span trspan="checkUser">%
,
'
Found trspan="checkUser"
'
)
or
explain
(
$res
->
[
2
]
->
[
0
],
'
trspan="checkUser"
'
);
count
(
1
);
ok
(
$res
=
$client
->
_post
(
'
/checkuser
',
IO::
String
->
new
(
$query
),
cookie
=>
"
lemonldap=
$id
",
length
=>
length
(
$query
),
accept
=>
'
text/html
',
),
'
POST checkuser
'
);
count
(
1
);
ok
(
$res
->
[
2
]
->
[
0
]
=~
m%<td class="align-middle">test_impersonation</td>%
,
'
Found macro test_impersonation
'
)
or
explain
(
$res
->
[
2
]
->
[
0
],
'
test_impersonation
'
);
ok
(
$res
->
[
2
]
->
[
0
]
=~
m%<td class="align-middle">msmith/msmith</td>%
,
'
Found msmith/msmith
'
)
or
explain
(
$res
->
[
2
]
->
[
0
],
'
Found msmith/msmith
'
);
count
(
2
);
$client
->
logout
(
$id
);
## Try to authenticate
ok
(
$res
=
$client
->
_get
(
'
/
',
accept
=>
'
text/html
'
),
'
Get Menu
',
);
count
(
1
);
...
...
lemonldap-ng-portal/t/lmConf-1.json
View file @
772b82cd
...
...
@@ -35,7 +35,7 @@
"key"
:
"qwertyui"
,
"locationRules"
:
{
"auth.example.com"
:
{
"(?#checkUser)^/checkuser"
:
"$uid eq
\"
dwho
\"
or $uid eq
\"
rtyler
\"
"
,
"(?#checkUser)^/checkuser"
:
"$uid eq
\"
dwho
\"
or $uid eq
\"
msmith
\"
"
,
"(?#errors)^/lmerror/"
:
"accept"
,
"default"
:
"accept"
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment