Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
lemonldap-ng
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maxime Besson
lemonldap-ng
Commits
7b36248c
Commit
7b36248c
authored
Dec 19, 2016
by
Yadd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SAML tests (#595)
parent
439dc6dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
9 deletions
+108
-9
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/SAML.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/SAML.pm
+3
-2
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-IdP-initiated.t
...portal/t/30-Auth-and-issuer-SAML-Artifact-IdP-initiated.t
+52
-3
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST-IdP-initiated.t
...-ng-portal/t/30-Auth-and-issuer-SAML-POST-IdP-initiated.t
+1
-1
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t
...portal/t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t
+52
-3
No files found.
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/SAML.pm
View file @
7b36248c
...
...
@@ -1509,7 +1509,7 @@ sub sloRelaySoap {
my
$session
=
$relayInfos
->
data
->
{
_lassoSessionDump
};
my
$identity
=
$relayInfos
->
data
->
{
_lassoIdentityDump
};
my
$providerID
=
$relayInfos
->
data
->
{
_providerID
};
my
$relayState
=
$relayInfos
->
data
->
{
_relayState
};
my
$relayState
=
$relayInfos
->
data
->
{
_relayState
}
//
''
;
my
$spConfKey
=
$self
->
spList
->
{
$providerID
}
->
{
confKey
};
if
(
$session
)
{
...
...
@@ -1531,7 +1531,8 @@ sub sloRelaySoap {
# Send the logout request
my
(
$rstatus
,
$rmethod
,
$rinfo
)
=
$self
->
sendLogoutRequestToProvider
(
$req
,
$logout
,
$providerID
,
Lasso::Constants::
HTTP_METHOD_SOAP
);
Lasso::Constants::
HTTP_METHOD_SOAP
,
undef
,
$relayState
);
unless
(
$rstatus
)
{
$self
->
lmLog
(
"
Fail to process SOAP logout request to
$providerID
",
'
error
'
);
...
...
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-IdP-initiated.t
View file @
7b36248c
...
...
@@ -7,8 +7,8 @@ BEGIN {
require
'
t/test-lib.pm
';
}
my
$maintests
=
18
;
my
$debug
=
'
debug
';
my
$maintests
=
21
;
my
$debug
=
'
error
';
my
(
$issuer
,
$sp
,
$res
);
my
%handlerOR
=
(
issuer
=>
[]
,
sp
=>
[]
);
...
...
@@ -108,13 +108,61 @@ SKIP: {
);
ok
(
$res
->
[
0
]
==
200
,
'
Return code is 200
'
);
#print STDERR Dumper($res);
ok
(
$res
->
[
2
]
->
[
0
]
=~
m#img src="http://auth.idp.com(/saml/relaySingleLogoutSOAP)\?(relay=.*?)"#s
,
'
Get image request
'
);
ok
(
$res
=
$issuer
->
_get
(
$
1
,
query
=>
$
2
,
#cookie => "lemonldap=$idpId",
accept
=>
'
text/html
'
),
'
Get image
'
);
ok
(
$issuer
->
getHeader
(
$res
,
'
Content-Type
'
)
eq
'
image/png
',
'
Get an image
'
);
}
count
(
$maintests
);
clean_sessions
();
done_testing
(
count
()
);
# Redefine LWP methods for tests
sub
LWP
::UserAgent::request {
my
(
$self
,
$req
)
=
@_
;
ok
(
$req
->
uri
=~
m#http://auth.sp.com(.*)#
,
'
Request from SP to IdP
'
);
my
$url
=
$
1
;
my
$res
;
my
$s
=
$req
->
content
;
ok
(
$res
=
$sp
->
_post
(
$url
,
IO::
String
->
new
(
$s
),
length
=>
length
(
$s
),
type
=>
'
application/xml
',
),
'
Execute request
'
);
ok
(
(
$res
->
[
0
]
==
200
or
$res
->
[
0
]
==
400
),
'
Response is 200 or 400
'
)
or
explain
(
$res
->
[
0
],
"
200 or 400
"
);
ok
(
$issuer
->
getHeader
(
$res
,
'
Content-Type
'
)
=~
m#^application/xml#
,
'
Content is XML
'
)
or
explain
(
$res
->
[
1
],
'
Content-Type => application/xml
'
);
my
$httpResp
=
HTTP::
Response
->
new
(
$res
->
[
0
],
'
OK
'
);
while
(
my
$name
=
shift
@
{
$res
->
[
1
]
}
)
{
$httpResp
->
header
(
$name
,
shift
(
@
{
$res
->
[
1
]
}
)
);
}
$httpResp
->
content
(
join
(
'',
@
{
$res
->
[
2
]
}
)
);
count
(
4
);
return
$httpResp
;
}
sub
switch
{
my
$type
=
shift
;
@
Lemonldap::NG::Handler::Main::Reload::
_onReload
=
@
{
...
...
@@ -127,6 +175,7 @@ sub issuer {
{
ini
=>
{
logLevel
=>
$debug
,
templatesDir
=>
'
site/htdocs/static
',
domain
=>
'
idp.com
',
portal
=>
'
http://auth.idp.com
',
authentication
=>
'
Demo
',
...
...
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST-IdP-initiated.t
View file @
7b36248c
...
...
@@ -8,7 +8,7 @@ BEGIN {
}
my
$maintests
=
21
;
my
$debug
=
'
debug
';
my
$debug
=
'
error
';
my
(
$issuer
,
$sp
,
$res
);
my
%handlerOR
=
(
issuer
=>
[]
,
sp
=>
[]
);
...
...
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t
View file @
7b36248c
...
...
@@ -7,8 +7,8 @@ BEGIN {
require
'
t/test-lib.pm
';
}
my
$maintests
=
18
;
my
$debug
=
'
debug
';
my
$maintests
=
21
;
my
$debug
=
'
error
';
my
(
$issuer
,
$sp
,
$res
);
my
%handlerOR
=
(
issuer
=>
[]
,
sp
=>
[]
);
...
...
@@ -108,13 +108,61 @@ SKIP: {
);
ok
(
$res
->
[
0
]
==
200
,
'
Return code is 200
'
);
#print STDERR Dumper($res);
ok
(
$res
->
[
2
]
->
[
0
]
=~
m#img src="http://auth.idp.com(/saml/relaySingleLogoutSOAP)\?(relay=.*?)"#s
,
'
Get image request
'
);
ok
(
$res
=
$issuer
->
_get
(
$
1
,
query
=>
$
2
,
#cookie => "lemonldap=$idpId",
accept
=>
'
text/html
'
),
'
Get image
'
);
ok
(
$issuer
->
getHeader
(
$res
,
'
Content-Type
'
)
eq
'
image/png
',
'
Get an image
'
);
}
count
(
$maintests
);
clean_sessions
();
done_testing
(
count
()
);
# Redefine LWP methods for tests
sub
LWP
::UserAgent::request {
my
(
$self
,
$req
)
=
@_
;
ok
(
$req
->
uri
=~
m#http://auth.sp.com(.*)#
,
'
Request from SP to IdP
'
);
my
$url
=
$
1
;
my
$res
;
my
$s
=
$req
->
content
;
ok
(
$res
=
$sp
->
_post
(
$url
,
IO::
String
->
new
(
$s
),
length
=>
length
(
$s
),
type
=>
'
application/xml
',
),
'
Execute request
'
);
ok
(
(
$res
->
[
0
]
==
200
or
$res
->
[
0
]
==
400
),
'
Response is 200 or 400
'
)
or
explain
(
$res
->
[
0
],
"
200 or 400
"
);
ok
(
$issuer
->
getHeader
(
$res
,
'
Content-Type
'
)
=~
m#^application/xml#
,
'
Content is XML
'
)
or
explain
(
$res
->
[
1
],
'
Content-Type => application/xml
'
);
my
$httpResp
=
HTTP::
Response
->
new
(
$res
->
[
0
],
'
OK
'
);
while
(
my
$name
=
shift
@
{
$res
->
[
1
]
}
)
{
$httpResp
->
header
(
$name
,
shift
(
@
{
$res
->
[
1
]
}
)
);
}
$httpResp
->
content
(
join
(
'',
@
{
$res
->
[
2
]
}
)
);
count
(
4
);
return
$httpResp
;
}
sub
switch
{
my
$type
=
shift
;
@
Lemonldap::NG::Handler::Main::Reload::
_onReload
=
@
{
...
...
@@ -127,6 +175,7 @@ sub issuer {
{
ini
=>
{
logLevel
=>
$debug
,
templatesDir
=>
'
site/htdocs/static
',
domain
=>
'
idp.com
',
portal
=>
'
http://auth.idp.com
',
authentication
=>
'
Demo
',
...
...
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