Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
3ac96f1a
"README.md" did not exist on "5ecbcd15784fe5151c79eddfbf86fd718deda041"
Commit
3ac96f1a
authored
6 years ago
by
Guy Halse
Browse files
Options
Downloads
Patches
Plain Diff
Add unit tests for mdui elements in SAMLParser
parent
1d1ee858
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/lib/SimpleSAML/Metadata/SAMLParserTest.php
+77
-0
77 additions, 0 deletions
tests/lib/SimpleSAML/Metadata/SAMLParserTest.php
with
77 additions
and
0 deletions
tests/lib/SimpleSAML/Metadata/SAMLParserTest.php
+
77
−
0
View file @
3ac96f1a
...
...
@@ -235,4 +235,81 @@ XML
}
}
}
/**
* Test RoleDescriptor/Extensions is parsed
*/
public
function
testRoleDescriptorExtensions
()
{
$expected
=
[
'scope'
=>
[
'example.org'
,
'example.net'
,
],
'UIInfo'
=>
[
'DisplayName'
=>
[
'en'
=>
'DisplayName'
,],
'Description'
=>
[
'en'
=>
'Description'
,],
'InformationURL'
=>
[
'en'
=>
'https://localhost/information'
,],
'PrivacyStatementURL'
=>
[
'en'
=>
'https://localhost/privacypolicy'
,],
'Logo'
=>
[
[
'url'
=>
'https://localhost/logo'
,
'height'
=>
16
,
'width'
=>
17
,
],
[
'url'
=>
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='
,
'height'
=>
2
,
'width'
=>
1
,
],
],
],
'DiscoHints'
=>
[
'IPHint'
=>
[
'127.0.0.1'
,
'127.0.0.2'
,],
'DomainHint'
=>
[
'example.net'
,
'example.org'
,],
'GeolocationHint'
=>
[
'geo:-29.00000,24.00000;u=830000'
,],
],
'name'
=>
[
'en'
=>
'DisplayName'
,],
];
$document
=
\SAML2\DOMDocumentFactory
::
fromString
(
<<<XML
<EntitiesDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" xmlns:shibmd="urn:mace:shibboleth:metadata:1.0" xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui">
<EntityDescriptor entityID="theEntityID">
<IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<Extensions>
<shibmd:Scope regexp="false">example.org</shibmd:Scope>
<shibmd:Scope regexp="false">example.net</shibmd:Scope>
<mdui:UIInfo>
<mdui:DisplayName xml:lang="en">DisplayName</mdui:DisplayName>
<mdui:Description xml:lang="en">Description</mdui:Description>
<mdui:PrivacyStatementURL xml:lang="en">https://localhost/privacypolicy</mdui:PrivacyStatementURL>
<mdui:InformationURL xml:lang="en">https://localhost/information</mdui:InformationURL>
<mdui:Logo width="17" height="16">https://localhost/logo</mdui:Logo>
<mdui:Logo width="1" height="2">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=</mdui:Logo>
</mdui:UIInfo>
<mdui:DiscoHints>
<mdui:IPHint>127.0.0.1</mdui:IPHint>
<mdui:IPHint>127.0.0.2</mdui:IPHint>
<mdui:DomainHint>example.net</mdui:DomainHint>
<mdui:DomainHint>example.org</mdui:DomainHint>
<mdui:GeolocationHint>geo:-29.00000,24.00000;u=830000</mdui:GeolocationHint>
</mdui:DiscoHints>
</Extensions>
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://IdentityProvider.com/SAML/SSO/Browser"/>
</IDPSSODescriptor>
</EntityDescriptor>
</EntitiesDescriptor>
XML
);
$entities
=
\SimpleSAML\Metadata\SAMLParser
::
parseDescriptorsElement
(
$document
->
documentElement
);
$this
->
assertArrayHasKey
(
'theEntityID'
,
$entities
);
// Various MDUI elements are accessible
$metadata
=
$entities
[
'theEntityID'
]
->
getMetadata20IdP
();
$this
->
assertEquals
(
$expected
[
'scope'
],
$metadata
[
'scope'
],
'shibmd:Scope elements not reflected in parsed metadata'
);
$this
->
assertEquals
(
$expected
[
'UIInfo'
],
$metadata
[
'UIInfo'
],
'mdui:UIInfo elements not reflected in parsed metadata'
);
$this
->
assertEquals
(
$expected
[
'DiscoHints'
],
$metadata
[
'DiscoHints'
],
'mdui:DiscoHints elements not reflected in parsed metadata'
);
$this
->
assertEquals
(
$expected
[
'name'
],
$metadata
[
'name'
]);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment