Passed
Branch monitor-2.5.x (74d2b5)
by Tim
02:19
created

Negotiate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 2
A invokeTest() 0 11 1
1
<?php
2
3
namespace SimpleSAML\Modules\Monitor\TestSuite\AuthSource;
4
5
use \SimpleSAML\Modules\Monitor\TestConfiguration as TestConfiguration;
6
use \SimpleSAML\Modules\Monitor\TestCase as TestCase;
7
use \SimpleSAML\Modules\Monitor\TestData as TestData;
8
9
final class Negotiate extends \SimpleSAML\Modules\Monitor\TestSuiteFactory
10
{
11
    /**
12
     * @var string|null
13
     */
14
    private $authorization;
15
16
    /**
17
     * @var KRB5NegotiateAuth
0 ignored issues
show
Bug introduced by
The type SimpleSAML\Modules\Monit...ource\KRB5NegotiateAuth was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
     */
19
    private $handle;
20
21
    /**
22
     * @param TestConfiguration $configuration
23
     * @param TestData $testData
24
     */
25
    public function __construct($configuration, $testData)
26
    {
27
        $authSourceData = $testData->getInputItem('authSourceData');
28
        $serverVars = $configuration->getServerVars();
29
30
        assert(is_array($authSourceData));
31
32
        $keytab = isSet($authSourceData['keytab']) ? $authSourceData['keytab'] : null;
33
        $this->handle = new \KRB5NegotiateAuth($keytab);
34
        $this->authorization = $serverVars->get('HTTP_AUTHORIZATION');
35
        $this->setCategory('SPNEGO authentication source');
36
37
        parent::__construct($configuration);
38
    }
39
40
    /**
41
     * @return void
42
     */
43
    public function invokeTest()
44
    {
45
        $input = array(
46
            'handle' => $this->handle,
47
            'authorization' => $this->authorization
48
        );
49
        $testData = new TestData($input);
50
51
        $test = new TestCase\AuthSource\Negotiate($testData);
52
        $this->addTestResult($test->getTestResult());
53
        $this->setTestResult($test->getTestResult());
54
    }
55
}
56