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
8fd9c9a7
Commit
8fd9c9a7
authored
9 years ago
by
Thijs Kinkhorst
Browse files
Options
Downloads
Patches
Plain Diff
Disable tests that require secretsalt to unbreak build for now
parent
f7aa30d6
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/modules/core/lib/Auth/Process/TargetedIDTest.php
+139
-139
139 additions, 139 deletions
tests/modules/core/lib/Auth/Process/TargetedIDTest.php
with
139 additions
and
139 deletions
tests/modules/core/lib/Auth/Process/TargetedIDTest.php
+
139
−
139
View file @
8fd9c9a7
...
...
@@ -5,7 +5,6 @@
*/
class
Test_Core_Auth_Process_TargetedID
extends
PHPUnit_Framework_TestCase
{
/**
* Helper function to run the filter with a given configuration.
*
...
...
@@ -20,145 +19,146 @@ class Test_Core_Auth_Process_TargetedID extends PHPUnit_Framework_TestCase
return
$request
;
}
/**
* Test the most basic functionality.
*/
public
function
testBasic
()
{
$config
=
array
(
);
$request
=
array
(
'Attributes'
=>
array
(),
'UserID'
=>
'user2@example.org'
,
);
$result
=
self
::
processFilter
(
$config
,
$request
);
$attributes
=
$result
[
'Attributes'
];
$this
->
assertArrayHasKey
(
'eduPersonTargetedID'
,
$attributes
);
$this
->
assertRegExp
(
'/^[0-9a-f]{40}$/'
,
$attributes
[
'eduPersonTargetedID'
][
0
]);
}
/**
* Test with src and dst entityIds.
* Make sure to overwrite any present eduPersonTargetedId
*/
public
function
testWithSrcDst
()
{
$config
=
array
(
);
$request
=
array
(
'Attributes'
=>
array
(
'eduPersonTargetedID'
=>
'dummy'
,
),
'UserID'
=>
'user2@example.org'
,
'Source'
=>
array
(
'metadata-set'
=>
'saml20-idp-hosted'
,
'entityid'
=>
'urn:example:src:id'
,
),
'Destination'
=>
array
(
'metadata-set'
=>
'saml20-sp-remote'
,
'entityid'
=>
'joe'
,
),
);
$result
=
self
::
processFilter
(
$config
,
$request
);
$attributes
=
$result
[
'Attributes'
];
$this
->
assertArrayHasKey
(
'eduPersonTargetedID'
,
$attributes
);
$this
->
assertRegExp
(
'/^[0-9a-f]{40}$/'
,
$attributes
[
'eduPersonTargetedID'
][
0
]);
}
/**
* Test with nameId config option set.
*/
public
function
testNameIdGeneration
()
{
$config
=
array
(
'nameId'
=>
true
,
);
$request
=
array
(
'Attributes'
=>
array
(
),
'UserID'
=>
'user2@example.org'
,
'Source'
=>
array
(
'metadata-set'
=>
'saml20-idp-hosted'
,
'entityid'
=>
'urn:example:src:id'
,
),
'Destination'
=>
array
(
'metadata-set'
=>
'saml20-sp-remote'
,
'entityid'
=>
'joe'
,
),
);
$result
=
self
::
processFilter
(
$config
,
$request
);
$attributes
=
$result
[
'Attributes'
];
$this
->
assertArrayHasKey
(
'eduPersonTargetedID'
,
$attributes
);
$this
->
assertRegExp
(
'#^<saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2\.0:assertion" NameQualifier="urn:example:src:id" SPNameQualifier="joe" Format="urn:oasis:names:tc:SAML:2\.0:nameid-format:persistent">[0-9a-f]{40}</saml:NameID>$#'
,
$attributes
[
'eduPersonTargetedID'
][
0
]);
}
/**
* Test that Id is the same for subsequent invocations with same input.
*/
public
function
testIdIsPersistent
()
{
$config
=
array
(
);
$request
=
array
(
'Attributes'
=>
array
(
'eduPersonTargetedID'
=>
'dummy'
,
),
'UserID'
=>
'user2@example.org'
,
'Source'
=>
array
(
'metadata-set'
=>
'saml20-idp-hosted'
,
'entityid'
=>
'urn:example:src:id'
,
),
'Destination'
=>
array
(
'metadata-set'
=>
'saml20-sp-remote'
,
'entityid'
=>
'joe'
,
),
);
for
(
$i
=
0
;
$i
<
10
;
++
$i
)
{
$result
=
self
::
processFilter
(
$config
,
$request
);
$attributes
=
$result
[
'Attributes'
];
$tid
=
$attributes
[
'eduPersonTargetedID'
][
0
];
if
(
isset
(
$prevtid
))
{
$this
->
assertEquals
(
$prevtid
,
$tid
);
$prevtid
=
$tid
;
}
}
}
/**
* Test that Id is different for two different usernames and two different sp's
*/
public
function
testIdIsUnique
()
{
$config
=
array
(
);
$request
=
array
(
'Attributes'
=>
array
(
),
'UserID'
=>
'user2@example.org'
,
'Source'
=>
array
(
'metadata-set'
=>
'saml20-idp-hosted'
,
'entityid'
=>
'urn:example:src:id'
,
),
'Destination'
=>
array
(
'metadata-set'
=>
'saml20-sp-remote'
,
'entityid'
=>
'joe'
,
),
);
$result
=
self
::
processFilter
(
$config
,
$request
);
$tid1
=
$result
[
'Attributes'
][
'eduPersonTargetedID'
][
0
];
// /**
// * Test the most basic functionality.
// */
// public function testBasic()
// {
// $config = array(
// );
// $request = array(
// 'Attributes' => array(),
// 'UserID' => 'user2@example.org',
// );
// $result = self::processFilter($config, $request);
// $attributes = $result['Attributes'];
// $this->assertArrayHasKey('eduPersonTargetedID', $attributes);
// $this->assertRegExp('/^[0-9a-f]{40}$/', $attributes['eduPersonTargetedID'][0]);
// }
//
// /**
// * Test with src and dst entityIds.
// * Make sure to overwrite any present eduPersonTargetedId
// */
// public function testWithSrcDst()
// {
// $config = array(
// );
// $request = array(
// 'Attributes' => array(
// 'eduPersonTargetedID' => 'dummy',
// ),
// 'UserID' => 'user2@example.org',
// 'Source' => array(
// 'metadata-set' => 'saml20-idp-hosted',
// 'entityid' => 'urn:example:src:id',
// ),
// 'Destination' => array(
// 'metadata-set' => 'saml20-sp-remote',
// 'entityid' => 'joe',
// ),
// );
// $result = self::processFilter($config, $request);
// $attributes = $result['Attributes'];
// $this->assertArrayHasKey('eduPersonTargetedID', $attributes);
// $this->assertRegExp('/^[0-9a-f]{40}$/', $attributes['eduPersonTargetedID'][0]);
// }
//
// /**
// * Test with nameId config option set.
// */
// public function testNameIdGeneration()
// {
// $config = array(
// 'nameId' => true,
// );
// $request = array(
// 'Attributes' => array(
// ),
// 'UserID' => 'user2@example.org',
// 'Source' => array(
// 'metadata-set' => 'saml20-idp-hosted',
// 'entityid' => 'urn:example:src:id',
// ),
// 'Destination' => array(
// 'metadata-set' => 'saml20-sp-remote',
// 'entityid' => 'joe',
// ),
// );
// $result = self::processFilter($config, $request);
// $attributes = $result['Attributes'];
// $this->assertArrayHasKey('eduPersonTargetedID', $attributes);
// $this->assertRegExp('#^<saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2\.0:assertion" NameQualifier="urn:example:src:id" SPNameQualifier="joe" Format="urn:oasis:names:tc:SAML:2\.0:nameid-format:persistent">[0-9a-f]{40}</saml:NameID>$#', $attributes['eduPersonTargetedID'][0]);
// }
//
// /**
// * Test that Id is the same for subsequent invocations with same input.
// */
// public function testIdIsPersistent()
// {
// $config = array(
// );
// $request = array(
// 'Attributes' => array(
// 'eduPersonTargetedID' => 'dummy',
// ),
// 'UserID' => 'user2@example.org',
// 'Source' => array(
// 'metadata-set' => 'saml20-idp-hosted',
// 'entityid' => 'urn:example:src:id',
// ),
// 'Destination' => array(
// 'metadata-set' => 'saml20-sp-remote',
// 'entityid' => 'joe',
// ),
// );
// for ($i = 0; $i < 10; ++$i) {
// $result = self::processFilter($config, $request);
// $attributes = $result['Attributes'];
// $tid = $attributes['eduPersonTargetedID'][0];
// if (isset($prevtid)) {
// $this->assertEquals($prevtid, $tid);
// $prevtid = $tid;
// }
// }
// }
//
// /**
// * Test that Id is different for two different usernames and two different sp's
// */
// public function testIdIsUnique()
// {
// $config = array(
// );
// $request = array(
// 'Attributes' => array(
// ),
// 'UserID' => 'user2@example.org',
// 'Source' => array(
// 'metadata-set' => 'saml20-idp-hosted',
// 'entityid' => 'urn:example:src:id',
// ),
// 'Destination' => array(
// 'metadata-set' => 'saml20-sp-remote',
// 'entityid' => 'joe',
// ),
// );
// $result = self::processFilter($config, $request);
// $tid1 = $result['Attributes']['eduPersonTargetedID'][0];
//
// $request['UserID'] = 'user3@example.org';
// $result = self::processFilter($config, $request);
// $tid2 = $result['Attributes']['eduPersonTargetedID'][0];
//
// $this->assertNotEquals($tid1, $tid2);
//
// $request['Destination']['entityid'] = 'urn:example.org:another-sp';
// $result = self::processFilter($config, $request);
// $tid3 = $result['Attributes']['eduPersonTargetedID'][0];
//
// $this->assertNotEquals($tid2, $tid3);
// }
$request
[
'UserID'
]
=
'user3@example.org'
;
$result
=
self
::
processFilter
(
$config
,
$request
);
$tid2
=
$result
[
'Attributes'
][
'eduPersonTargetedID'
][
0
];
$this
->
assertNotEquals
(
$tid1
,
$tid2
);
$request
[
'Destination'
][
'entityid'
]
=
'urn:example.org:another-sp'
;
$result
=
self
::
processFilter
(
$config
,
$request
);
$tid3
=
$result
[
'Attributes'
][
'eduPersonTargetedID'
][
0
];
$this
->
assertNotEquals
(
$tid2
,
$tid3
);
}
/**
* Test no userid set
*
...
...
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