1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SimpleSAML\Module\monitor\TestSuite\AuthSource; |
4
|
|
|
|
5
|
|
|
use \SimpleSAML\Module\monitor\TestConfiguration as TestConfiguration; |
6
|
|
|
use \SimpleSAML\Module\monitor\TestCase as TestCase; |
7
|
|
|
use \SimpleSAML\Module\monitor\TestData as TestData; |
8
|
|
|
|
9
|
|
|
final class Negotiate extends \SimpleSAML\Module\monitor\TestSuiteFactory |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* @var array |
13
|
|
|
*/ |
14
|
|
|
private $authSource = array(); |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var array |
18
|
|
|
*/ |
19
|
|
|
private $serverVars = array(); |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var array |
23
|
|
|
*/ |
24
|
|
|
private $requestVars = array(); |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @param TestConfiguration $configuration |
28
|
|
|
* @param TestData $testData |
29
|
|
|
*/ |
30
|
|
|
public function __construct($configuration, $testData) |
31
|
|
|
{ |
32
|
|
|
$authSource = $testData->getInput('authSource'); |
33
|
|
|
$this->serverVars = $configuration->getServerVars(); |
34
|
|
|
$this->requestVars = $configuration->getRequestVars(); |
35
|
|
|
|
36
|
|
|
assert(is_array($authSource)); |
37
|
|
|
$this->authSource = $authSource; |
38
|
|
|
|
39
|
|
|
parent::__construct($configuration); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return void |
44
|
|
|
*/ |
45
|
|
|
protected function invokeTestSuite() |
46
|
|
|
{ |
47
|
|
|
$input = array( |
48
|
|
|
'keytab' => $this->authSource['keytab'], |
49
|
|
|
'xml' => in_array('xml', get_object_vars($this->requestVars)) ? $this->requestVars->xml : null; |
|
|
|
|
50
|
|
|
'authorization' => in_array('HTTP_AUTHORIZATION', get_object_vars($this->serverVars)) ? $this->serverVars->HTTP_AUTHORIZATION : null; |
51
|
|
|
); |
52
|
|
|
$testData = new TestData($input); |
53
|
|
|
|
54
|
|
|
$test = new TestCase\AuthSource\Negotiate($this, $testData); |
55
|
|
|
$this->addTest($test); |
56
|
|
|
|
57
|
|
|
$this->addMessages($test->getMessages()); |
58
|
|
|
$this->calculateState(); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|