Code Duplication    Length = 53-56 lines in 2 locations

devices/ms/Device_W10.php 1 location

@@ 180-232 (lines=53) @@
177
</baseEap:Eap>
178
</Config>
179
';
180
        } elseif ($eap == \core\common\EAP::EAPTYPE_PEAP_MSCHAP2) {
181
            if (isset($attr['eap:enable_nea']) && $attr['eap:enable_nea'][0] == 'on') {
182
                $nea = 'true';
183
            } else {
184
                $nea = 'false';
185
            }
186
            $w10Ext = '<Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig">
187
<Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1">
188
<Type>25</Type>
189
<EapType xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1">
190
<ServerValidation>
191
<DisableUserPromptForServerValidation>true</DisableUserPromptForServerValidation>
192
<ServerNames>' . $servers . '</ServerNames>';
193
            if ($caArray) {
194
                foreach ($caArray as $certAuthority) {
195
                    if ($certAuthority['root']) {
196
                        $w10Ext .= "<TrustedRootCA>" . $certAuthority['sha1'] . "</TrustedRootCA>\n";
197
                    }
198
                }
199
            }
200
            $w10Ext .= '</ServerValidation>
201
<FastReconnect>true</FastReconnect> 
202
<InnerEapOptional>false</InnerEapOptional>
203
<Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1">
204
<Type>26</Type>
205
<EapType xmlns="http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1">
206
<UseWinLogonCredentials>false</UseWinLogonCredentials> 
207
</EapType>
208
</Eap>
209
<EnableQuarantineChecks>' . $nea . '</EnableQuarantineChecks>
210
<RequireCryptoBinding>false</RequireCryptoBinding>
211
';
212
            if ($useAnon == 1) {
213
                $w10Ext .= '<PeapExtensions>
214
<IdentityPrivacy xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">
215
<EnableIdentityPrivacy>true</EnableIdentityPrivacy>
216
';
217
                if ($outerUser) {
218
                    $w10Ext .= '<AnonymousUserName>' . $outerUser . '</AnonymousUserName>
219
                ';
220
                } else {
221
                    $w10Ext .= '<AnonymousUserName/>
222
                ';
223
                }
224
                $w10Ext .= '</IdentityPrivacy>
225
</PeapExtensions>
226
';
227
            }
228
            $w10Ext .= '</EapType>
229
</Eap>
230
</Config>
231
';
232
        } elseif ($eap == \core\common\EAP::EAPTYPE_TTLS_PAP || $eap == \core\common\EAP::EAPTYPE_TTLS_MSCHAP2) {
233
            if ($this->useGeantLink) {
234
                $innerMethod = 'MSCHAPv2';
235
                if ($eap == \core\common\EAP::EAPTYPE_TTLS_PAP) {

devices/ms/Device_W8.php 1 location

@@ 162-217 (lines=56) @@
159
</baseEap:Eap>
160
</Config>
161
';
162
        } elseif ($eap == \core\common\EAP::EAPTYPE_PEAP_MSCHAP2) {
163
            if (isset($attr['eap:enable_nea']) && $attr['eap:enable_nea'][0] == 'on') {
164
                $nea = 'true';
165
            } else {
166
                $nea = 'false';
167
            }
168
            $profileFileCont .= '<AuthorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</AuthorId>
169
</EapMethod>
170
';
171
            $w8Ext = '<Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig">
172
<Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1">
173
<Type>25</Type>
174
<EapType xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1">
175
<ServerValidation>
176
<DisableUserPromptForServerValidation>true</DisableUserPromptForServerValidation>
177
<ServerNames>' . $servers . '</ServerNames>';
178
            if ($caArray) {
179
                foreach ($caArray as $certAuthority) {
180
                    if ($certAuthority['root']) {
181
                        $w8Ext .= "<TrustedRootCA>" . $certAuthority['sha1'] . "</TrustedRootCA>\n";
182
                    }
183
                }
184
            }
185
            $w8Ext .= '</ServerValidation>
186
<FastReconnect>true</FastReconnect> 
187
<InnerEapOptional>false</InnerEapOptional> 
188
<Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1">
189
<Type>26</Type>
190
<EapType xmlns="http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1">
191
<UseWinLogonCredentials>false</UseWinLogonCredentials> 
192
</EapType>
193
</Eap>
194
<EnableQuarantineChecks>' . $nea . '</EnableQuarantineChecks>
195
<RequireCryptoBinding>false</RequireCryptoBinding>
196
';
197
            if ($useAnon == 1) {
198
                $w8Ext .= '<PeapExtensions>
199
<IdentityPrivacy xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">
200
<EnableIdentityPrivacy>true</EnableIdentityPrivacy>
201
';
202
                if ($outerUser) {
203
                    $w8Ext .= '<AnonymousUserName>' . $outerUser . '</AnonymousUserName>
204
                ';
205
                } else {
206
                    $w8Ext .= '<AnonymousUserName/>
207
                ';
208
                }
209
                $w8Ext .= '</IdentityPrivacy>
210
</PeapExtensions>
211
';
212
            }
213
            $w8Ext .= '</EapType>
214
</Eap>
215
</Config>
216
';
217
        } elseif ($eap == \core\common\EAP::EAPTYPE_TTLS_PAP || $eap == \core\common\EAP::EAPTYPE_TTLS_MSCHAP2) {
218
            $profileFileCont .= '<AuthorId xmlns="http://www.microsoft.com/provisioning/EapCommon">311</AuthorId>
219
</EapMethod>
220
';