Test Setup Failed
Push — master ( de37f4...b19653 )
by Tomasz
05:59
created

MsTlsProfile   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 26
c 1
b 0
f 0
dl 0
loc 50
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 5 1
A getTlsEapType() 0 8 1
A getTlsEap() 0 6 1
A getCredentialSource() 0 5 1
A getTlsServerValidation() 0 9 2
A __construct() 0 3 1
1
<?php
2
3
/* 
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace devices\ms;
10
11
class MsTlsProfile extends MsEapProfile
12
{
13
    const MS_TLS_NS = 'http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV1';    
14
        
15
    public function __construct() {
16
        $this->type = \core\common\EAP::TLS;
17
        $this->authorId = 0;
18
    }
19
    
20
    public function getConfig()
21
    {
22
        $element = new \core\DeviceXMLmain();
23
        $element->setChild('Eap', $this->getTlsEap(), self::MS_BASEEAPCONN_NS);
24
        return($element);
25
    }
26
    
27
    private function getTlsEap()
28
    {
29
        $element = new \core\DeviceXMLmain();
30
        $element->setChild('Type', $this->type);
31
        $element->setChild('EapType', $this->getTlsEapType(), self::MS_TLS_NS);
32
        return($element);        
33
    }
34
    
35
    private function getTlsEapType()
36
    {
37
        $element = new \core\DeviceXMLmain();
38
        $element->setChild('CredentialsSource', $this->getCredentialSource());
39
        $element->setChild('ServerValidation', $this->getTlsServerValidation());
40
        $element->setChild('DifferentUsername', $this->otherTlsName);
41
        $element->setChild('EnableQuarantineChecks', $this->nea);
42
        return($element);                
43
    }
44
    
45
    private function getCredentialSource()
46
    {
47
        $element = new \core\DeviceXMLmain();
48
        $element->setChild('CertificateStore','');
49
        return($element);
50
    }
51
    
52
    private function getTlsServerValidation()
53
    {
54
        $element = new \core\DeviceXMLmain();
55
        $element->setChild('DisableUserPromptForServerValidation', 'true');
56
        $element->setChild('ServerNames', $this->serverNames);
57
        foreach ($this->caList as $ca) {
58
            $element->setChild('TrustedRootCA', $ca['sha1']);
59
        }
60
        return($element);
61
    }
62
}
63