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
6d80abf1
Commit
6d80abf1
authored
6 years ago
by
Thijs Kinkhorst
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for AttributeConsumingService isDefault and index options
parent
30a9c739
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php
+86
-0
86 additions, 0 deletions
tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php
with
86 additions
and
0 deletions
tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php
+
86
−
0
View file @
6d80abf1
...
...
@@ -136,6 +136,92 @@ class SimpleSAML_Metadata_SAMLBuilderTest extends TestCase
}
}
/**
* Test the working of the isDefault config option
*/
public
function
testAttributeConsumingServiceDefault
()
{
$entityId
=
'https://entity.example.com/id'
;
$set
=
'saml20-sp-remote'
;
$metadata
=
array
(
'entityid'
=>
$entityId
,
'name'
=>
array
(
'en'
=>
'Test SP'
),
'metadata-set'
=>
$set
,
'attributes'
=>
array
(
'eduPersonTargetedID'
=>
'urn:oid:1.3.6.1.4.1.5923.1.1.1.10'
,
'eduPersonPrincipalName'
=>
'urn:oid:1.3.6.1.4.1.5923.1.1.1.6'
,
),
);
$samlBuilder
=
new
SimpleSAML_Metadata_SAMLBuilder
(
$entityId
);
$samlBuilder
->
addMetadata
(
$set
,
$metadata
);
$spDesc
=
$samlBuilder
->
getEntityDescriptor
();
$acs
=
$spDesc
->
getElementsByTagName
(
"AttributeConsumingService"
);
$acs1
=
$acs
->
item
(
0
);
$this
->
assertFalse
(
$acs1
->
hasAttribute
(
"isDefault"
));
$metadata
[
'attributes.isDefault'
]
=
true
;
$samlBuilder
=
new
SimpleSAML_Metadata_SAMLBuilder
(
$entityId
);
$samlBuilder
->
addMetadata
(
$set
,
$metadata
);
$spDesc
=
$samlBuilder
->
getEntityDescriptor
();
$acs
=
$spDesc
->
getElementsByTagName
(
"AttributeConsumingService"
);
$acs1
=
$acs
->
item
(
0
);
$this
->
assertTrue
(
$acs1
->
hasAttribute
(
"isDefault"
));
$this
->
assertEquals
(
"true"
,
$acs1
->
getAttribute
(
"isDefault"
));
$metadata
[
'attributes.isDefault'
]
=
false
;
$samlBuilder
=
new
SimpleSAML_Metadata_SAMLBuilder
(
$entityId
);
$samlBuilder
->
addMetadata
(
$set
,
$metadata
);
$spDesc
=
$samlBuilder
->
getEntityDescriptor
();
$acs
=
$spDesc
->
getElementsByTagName
(
"AttributeConsumingService"
);
$acs1
=
$acs
->
item
(
0
);
$this
->
assertTrue
(
$acs1
->
hasAttribute
(
"isDefault"
));
$this
->
assertEquals
(
"false"
,
$acs1
->
getAttribute
(
"isDefault"
));
}
/**
* Test the index option is used correctly.
*/
public
function
testAttributeConsumingServiceIndex
()
{
$entityId
=
'https://entity.example.com/id'
;
$set
=
'saml20-sp-remote'
;
$metadata
=
array
(
'entityid'
=>
$entityId
,
'name'
=>
array
(
'en'
=>
'Test SP'
),
'metadata-set'
=>
$set
,
'attributes'
=>
array
(
'eduPersonTargetedID'
=>
'urn:oid:1.3.6.1.4.1.5923.1.1.1.10'
,
'eduPersonPrincipalName'
=>
'urn:oid:1.3.6.1.4.1.5923.1.1.1.6'
,
),
);
$samlBuilder
=
new
SimpleSAML_Metadata_SAMLBuilder
(
$entityId
);
$samlBuilder
->
addMetadata
(
$set
,
$metadata
);
$spDesc
=
$samlBuilder
->
getEntityDescriptor
();
$acs
=
$spDesc
->
getElementsByTagName
(
"AttributeConsumingService"
);
$acs1
=
$acs
->
item
(
0
);
$this
->
assertTrue
(
$acs1
->
hasAttribute
(
"index"
));
$this
->
assertEquals
(
"0"
,
$acs1
->
getAttribute
(
"index"
));
$metadata
[
'attributes.index'
]
=
15
;
$samlBuilder
=
new
SimpleSAML_Metadata_SAMLBuilder
(
$entityId
);
$samlBuilder
->
addMetadata
(
$set
,
$metadata
);
$spDesc
=
$samlBuilder
->
getEntityDescriptor
();
$acs
=
$spDesc
->
getElementsByTagName
(
"AttributeConsumingService"
);
$acs1
=
$acs
->
item
(
0
);
$this
->
assertTrue
(
$acs1
->
hasAttribute
(
"index"
));
$this
->
assertEquals
(
"15"
,
$acs1
->
getAttribute
(
"index"
));
}
/**
* Test the required protocolSupportEnumeration in AttributeAuthorityDescriptor
*/
...
...
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