|
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 GeantLinkTtlsProfile extends MsEapProfile |
|
12
|
|
|
{ |
|
13
|
|
|
const GL_EAPMETAS_NS = 'urn:ietf:params:xml:ns:yang:ietf-eap-metadata'; |
|
14
|
|
|
|
|
15
|
|
|
public function __construct() |
|
16
|
|
|
{ |
|
17
|
|
|
$this->type = \core\common\EAP::TTLS; |
|
18
|
|
|
$this->authorId = 67532; |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
public function getConfig() |
|
22
|
|
|
{ |
|
23
|
|
|
$element = new \core\DeviceXMLmain(); |
|
24
|
|
|
$element->setChild('EAPIdentityProviderList', $this->getEapIdpList(), self::GL_EAPMETAS_NS); |
|
25
|
|
|
return($element); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
private function getEapIdpList() |
|
30
|
|
|
{ |
|
31
|
|
|
$element = new \core\DeviceXMLmain(); |
|
32
|
|
|
$element->setChild('EAPIdentityProvider', $this->getEapIdp()); |
|
33
|
|
|
return($element); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
private function getEapIdp() |
|
37
|
|
|
{ |
|
38
|
|
|
$element = new \core\DeviceXMLmain(); |
|
39
|
|
|
$element->setAttribute('ID', $this->idpId); |
|
40
|
|
|
$element->setAttribute('namespace', 'urn:UUID'); |
|
41
|
|
|
$element->setChild('ProviderInfo', $this->getProviderInfo()); |
|
42
|
|
|
$element->setChild('AuthenticationMethods', $this->getAuthMethods()); |
|
43
|
|
|
return($element); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
private function getProviderInfo() |
|
47
|
|
|
{ |
|
48
|
|
|
$element = new \core\DeviceXMLmain(); |
|
49
|
|
|
$element->setChild('DisplayName', $this->displayName); |
|
50
|
|
|
return($element); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
private function getAuthMethods() |
|
54
|
|
|
{ |
|
55
|
|
|
$element = new \core\DeviceXMLmain(); |
|
56
|
|
|
$element->setChild('AuthenticationMethod', $this->getAuthMethod()); |
|
57
|
|
|
return($element); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
private function getAuthMethod() |
|
61
|
|
|
{ |
|
62
|
|
|
$element = new \core\DeviceXMLmain(); |
|
63
|
|
|
$element->setChild('EAPMethod', $this->type); |
|
64
|
|
|
$element->setChild('ClientSideCredential', $this->getClientSideCredential()); |
|
65
|
|
|
$element->setChild('ServerSideCredential', $this->getServerSideCredential()); |
|
66
|
|
|
$element->setChild('InnerAuthenticationMethod', $this->getInnerAuthenticationMethod()); |
|
67
|
|
|
$element->setChild('VendorSpecific', $this->getVendorSpecific()); |
|
68
|
|
|
return($element); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
private function getClientSideCredential() |
|
72
|
|
|
{ |
|
73
|
|
|
$element = new \core\DeviceXMLmain(); |
|
74
|
|
|
$element->setChild('allow-save', 'true'); |
|
75
|
|
|
if ($this->outerId !== NULL) { |
|
76
|
|
|
$element->setChild('AnonymousIdentity', $this->outerId); |
|
77
|
|
|
} |
|
78
|
|
|
return($element); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
private function getServerSideCredential() |
|
82
|
|
|
{ |
|
83
|
|
|
$element = new \core\DeviceXMLmain(); |
|
84
|
|
|
$element->setChild('CA', $this->getCA()); |
|
85
|
|
|
$element->setChild('ServerName', explode(';', $this->serverNames)); |
|
86
|
|
|
return($element); |
|
87
|
|
|
|
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
private function getInnerAuthenticationMethod() |
|
91
|
|
|
{ |
|
92
|
|
|
$element = new \core\DeviceXMLmain(); |
|
93
|
|
|
$element->setChild('NonEAPAuthMethod', $this->innerTypeDisplay); |
|
94
|
|
|
return($element); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
private function getVendorSpecific() |
|
98
|
|
|
{ |
|
99
|
|
|
$element = new \core\DeviceXMLmain(); |
|
100
|
|
|
$element->setChild('SessionResumption', 'false'); |
|
101
|
|
|
return($element); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
private function getCA() |
|
105
|
|
|
{ |
|
106
|
|
|
$retArray = []; |
|
107
|
|
|
foreach ($this->caList as $ca) { |
|
108
|
|
|
if ($ca['root']) { |
|
109
|
|
|
$element = new \core\DeviceXMLmain(); |
|
110
|
|
|
$element->setChild('format', 'PEM'); |
|
111
|
|
|
$element->setChild('cert-data', base64_encode($ca['der'])); |
|
112
|
|
|
$retArray[] = $element; |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
return($retArray); |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
} |