Code Duplication    Length = 53-56 lines in 2 locations

devices/ms/Device_W10.php 1 location

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

devices/ms/Device_W8.php 1 location

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