|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * EAP Wizard: Private implementation. |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <QDebug> |
|
20 #include <QDataStream> |
|
21 #include <HbTranslator> |
|
22 #include <HbParameterLengthLimiter> |
|
23 #include <eapqtconfiginterface.h> |
|
24 #include <eapqtplugininfo.h> |
|
25 #include <eapqtpluginhandle.h> |
|
26 #include <eapqtconfig.h> |
|
27 #include <eapqtpacstoreconfig.h> |
|
28 #include <eapqtcertificateinfo.h> |
|
29 #include <wlanerrorcodes.h> |
|
30 |
|
31 // User includes |
|
32 #include "wlanwizardhelper.h" |
|
33 #include "wlanwizardplugin.h" |
|
34 #include "eapwizard.h" |
|
35 #include "eapwizard_p.h" |
|
36 #include "eapwizarduistrings.h" |
|
37 #include "eapwizardpageoutertype.h" |
|
38 #include "eapwizardpagecertca.h" |
|
39 #include "eapwizardpagecertuser.h" |
|
40 #include "eapwizardpageidentity.h" |
|
41 #include "eapwizardpageinnertype.h" |
|
42 #include "eapwizardpageusernamepassword.h" |
|
43 #include "eapwizardpagenewpacstore.h" |
|
44 #include "eapwizardpagepacstorepasswordconfirm.h" |
|
45 #include "OstTraceDefinitions.h" |
|
46 #ifdef OST_TRACE_COMPILER_IN_USE |
|
47 #include "eapwizard_pTraces.h" |
|
48 #endif |
|
49 |
|
50 /*! |
|
51 \class EapWizardPrivate |
|
52 \brief Implements the EAP wizard plugin for WLAN wizard. |
|
53 */ |
|
54 |
|
55 // External function prototypes |
|
56 |
|
57 // Local constants |
|
58 |
|
59 |
|
60 // ======== LOCAL FUNCTIONS ======== |
|
61 |
|
62 // ======== MEMBER FUNCTIONS ======== |
|
63 |
|
64 /*! |
|
65 Constructor of EAP Wizard. |
|
66 |
|
67 @param [in] wizardHelper pointer to the helper instance. |
|
68 */ |
|
69 EapWizardPrivate::EapWizardPrivate( |
|
70 WlanWizardHelper *wizardHelper) : |
|
71 mWizardHelper(wizardHelper), |
|
72 mTranslator(new HbTranslator("eapwizard")), |
|
73 mEapConfIf(new EapQtConfigInterface( |
|
74 EapQtConfigInterface::EapBearerTypeWlan, |
|
75 EapQtConfigInterface::IapIdUndefined)) |
|
76 { |
|
77 Q_ASSERT(wizardHelper); |
|
78 createPages(); |
|
79 } |
|
80 |
|
81 /*! |
|
82 Destructor. |
|
83 */ |
|
84 EapWizardPrivate::~EapWizardPrivate() |
|
85 { |
|
86 } |
|
87 |
|
88 /*! |
|
89 See EapWizard::summary(). |
|
90 */ |
|
91 bool EapWizardPrivate::summary( |
|
92 WlanWizardPlugin::Summary sum, |
|
93 QString &item, |
|
94 QString &value) |
|
95 { |
|
96 bool ret = false; |
|
97 int outerType = configurations(EapWizardPrivate::OuterType).toInt(); |
|
98 |
|
99 switch (sum) { |
|
100 case WlanWizardPlugin::SummaryEapInnerType: |
|
101 if (hasInnerMethod()) { |
|
102 item = hbTrId("txt_occ_dblist_inner_eap"); |
|
103 value = eapTypeToString(configurations(EapWizardPrivate::InnerType).toInt()); |
|
104 ret = true; |
|
105 } |
|
106 break; |
|
107 |
|
108 case WlanWizardPlugin::SummaryEapFastProvisioningMode: |
|
109 if (outerType == EapQtPluginHandle::PluginEapFast) { |
|
110 item = hbTrId("txt_occ_dblist_provisioning_mode_for_eapfast"); |
|
111 value = hbTrId("txt_occ_dblist_provisioning_mode_for_val_unauthent"); |
|
112 ret = true; |
|
113 } |
|
114 break; |
|
115 |
|
116 default: |
|
117 Q_ASSERT(sum == WlanWizardPlugin::SummaryEapOuterType); |
|
118 item = hbTrId("txt_occ_dblist_outer_eap"); |
|
119 value = eapTypeToString(outerType); |
|
120 ret = true; |
|
121 break; |
|
122 |
|
123 } |
|
124 return ret; |
|
125 } |
|
126 |
|
127 /*! |
|
128 See EapWizard::storeSettings(). |
|
129 |
|
130 @return true - ok, false - failed |
|
131 */ |
|
132 bool EapWizardPrivate::storeSettings() |
|
133 { |
|
134 bool ret = false; |
|
135 EapQtPluginHandle outerType(static_cast<EapQtPluginHandle::Plugin>( |
|
136 configurations(OuterType).toInt())); |
|
137 |
|
138 int iapId = mWizardHelper->configuration(WlanWizardHelper::ConfIapId).toInt(); |
|
139 |
|
140 if (mEapConfIf->setConfigurationReference(iapId) |
|
141 && storeOuterTypeSettings(outerType) |
|
142 && storeInnerTypeSettings(outerType)) { |
|
143 ret = true; |
|
144 } |
|
145 |
|
146 return ret; |
|
147 } |
|
148 |
|
149 /*! |
|
150 See WlanWizardPlugin::errorString(). |
|
151 |
|
152 Returns EAP spesific error string. |
|
153 */ |
|
154 QString EapWizardPrivate::errorString(int errorCode) |
|
155 { |
|
156 char* textId = NULL; |
|
157 int eapType = EapQtPluginHandle::PluginUndefined; |
|
158 |
|
159 switch (errorCode){ |
|
160 case KErrWlanUserRejected: |
|
161 textId = "txt_occ_dialog_1_auth_failed_user_cert_rej"; |
|
162 eapType = configurations(OuterType).toInt(); |
|
163 break; |
|
164 |
|
165 case KErrWlanUserCertificateExpired: |
|
166 textId = "txt_occ_dialog_1_auth_failed_user_cert_exp"; |
|
167 eapType = configurations(OuterType).toInt(); |
|
168 break; |
|
169 |
|
170 case KErrWlanServerCertificateExpired: |
|
171 textId = "txt_occ_dialog_1_authentication_failed_server_ce"; |
|
172 eapType = configurations(OuterType).toInt(); |
|
173 break; |
|
174 |
|
175 case KErrWlanCerficateVerifyFailed: |
|
176 textId = "txt_occ_dialog_1_authentication_failed_could_not"; |
|
177 eapType = configurations(OuterType).toInt(); |
|
178 break; |
|
179 |
|
180 case KErrWlanNoCipherSuite: |
|
181 textId = "txt_occ_dialog_1_authentication_failed_cipher_su"; |
|
182 eapType = configurations(OuterType).toInt(); |
|
183 break; |
|
184 |
|
185 case KErrWlanSimNotInstalled: |
|
186 textId = "txt_occ_dialog_1_authentication_failed_check_sim"; |
|
187 eapType = configurations(OuterType).toInt(); |
|
188 break; |
|
189 |
|
190 case KErrWlanEapFastPacStoreCorrupted: |
|
191 textId = "txt_occ_dialog_1_authentication_failed_reset_pac"; |
|
192 eapType = EapQtPluginHandle::PluginEapFast; |
|
193 break; |
|
194 |
|
195 case KErrWlanEapSimFailed: |
|
196 case KErrWlanEapTlsFailed: |
|
197 case KErrWlanEapPeapFailed: |
|
198 case KErrWlanEapAkaFailed: |
|
199 case KErrWlanEapTtlsFailed: |
|
200 case KErrWlanLeapFailed: |
|
201 case KErrWlanNoUserCertificate: |
|
202 case KErrWlanEapFastTunnelCompromiseError: |
|
203 case KErrWlanEapFastUnexpextedTlvExhanged: |
|
204 case KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled: |
|
205 case KErrWlanEapFastNoMatchingPacForAid: |
|
206 case KErrWlanEapFastAuthFailed: |
|
207 textId = "txt_occ_dialog_1_authentication_failed"; |
|
208 eapType = configurations(OuterType).toInt(); |
|
209 break; |
|
210 |
|
211 case KErrWlanEapMsChapv2: |
|
212 case KErrWlanEapGtcFailed: |
|
213 textId = "txt_occ_dialog_1_authentication_failed"; |
|
214 eapType = configurations(InnerType).toInt(); |
|
215 break; |
|
216 |
|
217 case KErrWlanNotSubscribed: |
|
218 case KErrWlanAccessBarred: |
|
219 case KErrWlanPasswordExpired: |
|
220 case KErrWlanNoDialinPermissions: |
|
221 case KErrWlanAccountDisabled: |
|
222 case KErrWlanRestrictedLogonHours: |
|
223 textId = "txt_occ_dialog_1_authentication_failed"; |
|
224 if (hasInnerMethod()){ |
|
225 eapType = configurations(InnerType).toInt(); |
|
226 } else { |
|
227 eapType = configurations(OuterType).toInt(); |
|
228 } |
|
229 break; |
|
230 |
|
231 default: |
|
232 // Return empty string |
|
233 break; |
|
234 } |
|
235 |
|
236 QString string; |
|
237 if (textId) { |
|
238 string = HbParameterLengthLimiter(hbTrId(textId)).arg(eapTypeToString(eapType)); |
|
239 } |
|
240 |
|
241 return string; |
|
242 } |
|
243 |
|
244 /*! |
|
245 Reader method for eap configurations. |
|
246 |
|
247 See ConfigurationId for further details about the data types in QVariant. |
|
248 |
|
249 @param [in] confId Defines what configuration is read. |
|
250 |
|
251 @return configuration value. |
|
252 */ |
|
253 QVariant EapWizardPrivate::configurations(ConfigurationId confId) const |
|
254 { |
|
255 Q_ASSERT(mConfigurations.contains(confId)); |
|
256 |
|
257 #ifdef OST_TRACE_COMPILER_IN_USE |
|
258 QString tmp; |
|
259 QDebug tmpStream(&tmp ); |
|
260 tmpStream << mConfigurations[confId]; |
|
261 TPtrC16 string(tmp.utf16(), tmp.length() ); |
|
262 |
|
263 OstTraceExt2( |
|
264 TRACE_NORMAL, |
|
265 EAPWIZARDPRIVATE_CONFIGURATIONS, |
|
266 "EapWizardPrivate::configurations;confId=%{ConfigurationId};string=%S", |
|
267 (TUint)confId, string ); |
|
268 #endif |
|
269 |
|
270 return mConfigurations[confId]; |
|
271 } |
|
272 |
|
273 /*! |
|
274 Sets EAP configuration value for given configuration identifier. |
|
275 See ConfigurationId for further details about the data types in QVariant. |
|
276 |
|
277 @param [in] confId Configuration Identifier do to be set |
|
278 @param [in] value Value for configuration. |
|
279 */ |
|
280 void EapWizardPrivate::setConfigurations( |
|
281 ConfigurationId confId, const QVariant &value) |
|
282 { |
|
283 #ifdef OST_TRACE_COMPILER_IN_USE |
|
284 QString tmp; |
|
285 QDebug tmpStream(&tmp ); |
|
286 tmpStream << value; |
|
287 TPtrC16 string( tmp.utf16(), tmp.length() ); |
|
288 |
|
289 OstTraceExt2( |
|
290 TRACE_NORMAL, |
|
291 EAPWIZARDPRIVATE_SETCONFIGURATIONS, |
|
292 "EapWizardPrivate::setConfigurations;confId=%{ConfigurationId};string=%S", |
|
293 (TUint)confId, string ); |
|
294 #endif |
|
295 |
|
296 mConfigurations[confId] = value; |
|
297 } |
|
298 |
|
299 /*! |
|
300 @return pointer to EapQtConfigInterface. |
|
301 */ |
|
302 EapQtConfigInterface* EapWizardPrivate::eapConfigurationInterface() const |
|
303 { |
|
304 Q_ASSERT(mEapConfIf.data()); |
|
305 return mEapConfIf.data(); |
|
306 } |
|
307 |
|
308 /*! |
|
309 Maps given EAP Qt Plugin handle into string. |
|
310 |
|
311 @param [in] id EapQtPluginHandle::Handle, id to be mapped to string. |
|
312 |
|
313 @return EAP String. |
|
314 */ |
|
315 QString EapWizardPrivate::eapTypeToString(int id) const |
|
316 { |
|
317 QString locId; |
|
318 switch (id) { |
|
319 case EapQtPluginHandle::PluginEapAka: |
|
320 locId = EapWizardUiStrings::EapAka; |
|
321 break; |
|
322 |
|
323 case EapQtPluginHandle::PluginEapFast: |
|
324 locId = EapWizardUiStrings::EapFast; |
|
325 break; |
|
326 |
|
327 case EapQtPluginHandle::PluginLeap: |
|
328 locId = EapWizardUiStrings::Leap; |
|
329 break; |
|
330 |
|
331 case EapQtPluginHandle::PluginPeap: |
|
332 locId = EapWizardUiStrings::Peap; |
|
333 break; |
|
334 |
|
335 case EapQtPluginHandle::PluginEapSim: |
|
336 locId = EapWizardUiStrings::EapSim; |
|
337 break; |
|
338 |
|
339 case EapQtPluginHandle::PluginEapTls: |
|
340 locId = EapWizardUiStrings::EapTls; |
|
341 break; |
|
342 |
|
343 case EapQtPluginHandle::PluginEapTtls: |
|
344 locId = EapWizardUiStrings::EapTtls; |
|
345 break; |
|
346 |
|
347 case EapQtPluginHandle::PluginEapMschapv2: |
|
348 locId = EapWizardUiStrings::EapMschapv2; |
|
349 break; |
|
350 |
|
351 case EapQtPluginHandle::PluginEapGtc: |
|
352 locId = EapWizardUiStrings::EapGtc; |
|
353 break; |
|
354 |
|
355 case EapQtPluginHandle::PluginPap: |
|
356 locId = EapWizardUiStrings::Pap; |
|
357 break; |
|
358 |
|
359 default: |
|
360 // Invalid enum |
|
361 Q_ASSERT(EapQtPluginHandle::PluginPlainMschapv2 == id); |
|
362 locId = EapWizardUiStrings::Mschapv2; |
|
363 break; |
|
364 } |
|
365 |
|
366 return locId; |
|
367 } |
|
368 |
|
369 /*! |
|
370 Accessor to WLAN Wizard Helper objects. |
|
371 |
|
372 @return a pointer to helper object. |
|
373 */ |
|
374 WlanWizardHelper *EapWizardPrivate::wizardHelper() const |
|
375 { |
|
376 Q_ASSERT(mWizardHelper); |
|
377 return mWizardHelper; |
|
378 } |
|
379 |
|
380 /*! |
|
381 Creates EAP Wizard pages and add those to the wizard framework. |
|
382 */ |
|
383 void EapWizardPrivate::createPages() |
|
384 { |
|
385 mWizardHelper->addPage( |
|
386 EapWizardPage::PageOuterType, |
|
387 new EapWizardPageOuterType(this)); |
|
388 |
|
389 mWizardHelper->addPage( |
|
390 EapWizardPage::PageCertificateCa, |
|
391 new EapWizardPageCertCa(this)); |
|
392 |
|
393 mWizardHelper->addPage( |
|
394 EapWizardPage::PageCertificateUser, |
|
395 new EapWizardPageCertUser(this)); |
|
396 |
|
397 mWizardHelper->addPage( |
|
398 EapWizardPage::PageIdentity, |
|
399 new EapWizardPageIdentity(this)); |
|
400 |
|
401 mWizardHelper->addPage( |
|
402 EapWizardPage::PageInnerTypeEapTtls, |
|
403 new EapWizardPageInnerType( |
|
404 this, |
|
405 EapQtPluginHandle::PluginEapTtls)); |
|
406 |
|
407 mWizardHelper->addPage( |
|
408 EapWizardPage::PageInnerTypePeap, |
|
409 new EapWizardPageInnerType( |
|
410 this, |
|
411 EapQtPluginHandle::PluginPeap)); |
|
412 |
|
413 mWizardHelper->addPage( |
|
414 EapWizardPage::PageUsernamePassword, |
|
415 new EapWizardPageUsernamePassword(this)); |
|
416 |
|
417 mWizardHelper->addPage( |
|
418 EapWizardPage::PageNewPacStorePassword, |
|
419 new EapWizardPageNewPacStore(this)); |
|
420 |
|
421 mWizardHelper->addPage( |
|
422 EapWizardPage::PagePromptPacStorePassword, |
|
423 new EapWizardPagePacStorePasswordConfirm(this)); |
|
424 } |
|
425 |
|
426 /*! |
|
427 Check whether selected outer type has inner method. |
|
428 |
|
429 @return true if inner method exists, false otherwise. |
|
430 */ |
|
431 bool EapWizardPrivate::hasInnerMethod() const |
|
432 { |
|
433 int outerType = configurations(EapWizardPrivate::OuterType).toInt(); |
|
434 bool ret = false; |
|
435 |
|
436 switch (outerType){ |
|
437 case EapQtPluginHandle::PluginEapTtls: |
|
438 case EapQtPluginHandle::PluginPeap: |
|
439 case EapQtPluginHandle::PluginEapFast: |
|
440 ret = true; |
|
441 break; |
|
442 } |
|
443 |
|
444 return ret; |
|
445 } |
|
446 |
|
447 |
|
448 /* |
|
449 Handles TLS methods (PEAP, EAP-TLS and EAP-TTLS) settings. |
|
450 |
|
451 Stores configurations to eapConf |
|
452 |
|
453 @param [in,out] eapConf configuration is written to this object. |
|
454 @param [in] outerType Outer EAP method |
|
455 */ |
|
456 void EapWizardPrivate::handleTlsMethodsSettings( |
|
457 EapQtConfig &eapConf, |
|
458 EapQtPluginHandle &outerType) |
|
459 { |
|
460 // Common stuff for all tls methods |
|
461 eapConf.setValue(EapQtConfig::UseIdentityPrivacy, false); |
|
462 eapConf.setValue(EapQtConfig::VerifyServerRealm, false); |
|
463 eapConf.setValue(EapQtConfig::ClientAuthenticationRequired, false); |
|
464 eapConf.setValue(EapQtConfig::UsernameAutomatic, configurations(TunnelUsernameAutomatic)); |
|
465 eapConf.setValue(EapQtConfig::Username, configurations(TunnelUsername)); |
|
466 eapConf.setValue(EapQtConfig::RealmAutomatic, configurations(TunnelRealmAutomatic)); |
|
467 eapConf.setValue(EapQtConfig::Realm, configurations(TunnelRealm)); |
|
468 |
|
469 QVariant certVariant = configurations(CertificateCa); |
|
470 |
|
471 if (certVariant.canConvert<EapQtCertificateInfo> ()) { |
|
472 QList<QVariant> caCerts; |
|
473 caCerts.append(certVariant); |
|
474 eapConf.setValue(EapQtConfig::AuthorityCertificate, caCerts); |
|
475 eapConf.setValue(EapQtConfig::AuthorityCertificateAutomatic, false); |
|
476 } else { |
|
477 eapConf.setValue(EapQtConfig::AuthorityCertificateAutomatic, true); |
|
478 } |
|
479 |
|
480 // type specific configurations |
|
481 if (outerType == EapQtPluginHandle::PluginEapTls) { |
|
482 QList<QVariant> userCerts; |
|
483 userCerts.append(configurations(CertificateUser)); |
|
484 eapConf.setValue(EapQtConfig::ClientAuthenticationRequired, true); |
|
485 eapConf.setValue(EapQtConfig::UserCertificate, userCerts); |
|
486 |
|
487 } else if (outerType == EapQtPluginHandle::PluginPeap) { |
|
488 |
|
489 switch (configurations(InnerType).toInt()) { |
|
490 case EapQtPluginHandle::PluginEapMschapv2: |
|
491 // EAP-MSCHAPv2: enable v0 only |
|
492 eapConf.setValue(EapQtConfig::PeapVersion0Allowed, true); |
|
493 eapConf.setValue(EapQtConfig::PeapVersion1Allowed, false); |
|
494 break; |
|
495 |
|
496 case EapQtPluginHandle::PluginEapGtc: |
|
497 // EAP-GTC: enable v1 only |
|
498 eapConf.setValue(EapQtConfig::PeapVersion0Allowed, false); |
|
499 eapConf.setValue(EapQtConfig::PeapVersion1Allowed, true); |
|
500 break; |
|
501 } |
|
502 eapConf.setValue(EapQtConfig::PeapVersion2Allowed, false); |
|
503 } |
|
504 } |
|
505 |
|
506 /*! |
|
507 Handles configurations for EAP-FAST. |
|
508 |
|
509 @param [in,out] eapConf EAP Configuration |
|
510 |
|
511 @param false in case of failure. |
|
512 */ |
|
513 bool EapWizardPrivate::handleEapFastSettings(EapQtConfig &eapConf) |
|
514 { |
|
515 bool ret = true; |
|
516 EapQtPacStoreConfig pacStoreConf; |
|
517 |
|
518 eapConf.setValue(EapQtConfig::ProvisioningModeAuthenticated, false); |
|
519 eapConf.setValue(EapQtConfig::ProvisioningModeUnauthenticated, true); |
|
520 eapConf.setValue(EapQtConfig::VerifyServerRealm, false); |
|
521 eapConf.setValue(EapQtConfig::UseIdentityPrivacy, false); |
|
522 |
|
523 switch (configurations(PacStoreState).toInt()) { |
|
524 case EapQtPacStoreConfig::PacStoreStateStoreNotExists: |
|
525 case EapQtPacStoreConfig::PacStoreStatePasswordRequired: |
|
526 pacStoreConf.setValue( |
|
527 EapQtPacStoreConfig::PacStorePassword, |
|
528 configurations(PacStorePassword)); |
|
529 |
|
530 pacStoreConf.setValue( |
|
531 EapQtPacStoreConfig::PacStoreSavePassword, |
|
532 true); |
|
533 |
|
534 if (!mEapConfIf->savePacStoreConfiguration(pacStoreConf)) { |
|
535 // no cleaning required |
|
536 ret = false; |
|
537 } |
|
538 break; |
|
539 |
|
540 default: |
|
541 // Do nothing |
|
542 break; |
|
543 } |
|
544 |
|
545 return ret; |
|
546 } |
|
547 |
|
548 /*! |
|
549 Handles configurations for EAP-AKA and EAP-SIM. |
|
550 |
|
551 @param [in,out] eapConf EAP Configuration |
|
552 */ |
|
553 void EapWizardPrivate::handleEapAkaSimSettings(EapQtConfig &eapConf) |
|
554 { |
|
555 eapConf.setValue(EapQtConfig::UsernameAutomatic, true); |
|
556 eapConf.setValue(EapQtConfig::RealmAutomatic, true); |
|
557 } |
|
558 |
|
559 /*! |
|
560 Handles configurations for LEAP. |
|
561 |
|
562 @param [in,out] eapConf EAP Configuration |
|
563 */ |
|
564 void EapWizardPrivate::handleLeapSettings(EapQtConfig &eapConf) |
|
565 { |
|
566 eapConf.setValue(EapQtConfig::UsernameAutomatic, false); |
|
567 eapConf.setValue(EapQtConfig::Username, configurations(Username)); |
|
568 eapConf.setValue(EapQtConfig::PasswordPrompt, false); |
|
569 eapConf.setValue(EapQtConfig::Password, configurations(Password)); |
|
570 } |
|
571 |
|
572 /*! |
|
573 Store outer type settings. |
|
574 |
|
575 @param outerType reference to outertype |
|
576 |
|
577 @return false in case of failure. |
|
578 */ |
|
579 bool EapWizardPrivate::storeOuterTypeSettings(EapQtPluginHandle &outerType) |
|
580 { |
|
581 EapQtConfig eapConf; |
|
582 |
|
583 // 1. Store outer type settings |
|
584 switch (outerType.pluginId()) { |
|
585 case EapQtPluginHandle::PluginEapTtls: |
|
586 case EapQtPluginHandle::PluginPeap: |
|
587 case EapQtPluginHandle::PluginEapTls: |
|
588 handleTlsMethodsSettings(eapConf, outerType); |
|
589 break; |
|
590 |
|
591 case EapQtPluginHandle::PluginEapFast: |
|
592 if (!handleEapFastSettings(eapConf)) { |
|
593 return false; |
|
594 } |
|
595 break; |
|
596 |
|
597 case EapQtPluginHandle::PluginEapAka: |
|
598 case EapQtPluginHandle::PluginEapSim: |
|
599 handleEapAkaSimSettings(eapConf); |
|
600 break; |
|
601 |
|
602 default: |
|
603 Q_ASSERT(outerType == EapQtPluginHandle::PluginLeap); |
|
604 handleLeapSettings(eapConf); |
|
605 break; |
|
606 } |
|
607 |
|
608 if (hasInnerMethod()) { |
|
609 EapQtPluginHandle inner = static_cast<EapQtPluginHandle::Plugin>( |
|
610 configurations(InnerType).toInt()); |
|
611 |
|
612 QList<QVariant> innerType; |
|
613 innerType.append(qVariantFromValue(inner)); |
|
614 eapConf.setValue(EapQtConfig::InnerType, innerType); |
|
615 } |
|
616 |
|
617 // store outer type configurations |
|
618 if (!mEapConfIf->saveConfiguration(outerType, eapConf)){ |
|
619 mEapConfIf->deleteConfiguration(); |
|
620 return false; |
|
621 } |
|
622 |
|
623 QList<EapQtPluginHandle> selectedOuterTypes; |
|
624 selectedOuterTypes.append(outerType); |
|
625 if (!mEapConfIf->setSelectedOuterTypes(selectedOuterTypes)){ |
|
626 mEapConfIf->deleteConfiguration(); |
|
627 return false; |
|
628 } |
|
629 |
|
630 return true; |
|
631 } |
|
632 |
|
633 |
|
634 /*! |
|
635 Store inner type settings if exists. |
|
636 |
|
637 @param outerType reference to outertype |
|
638 |
|
639 @return false in case of failure. |
|
640 */ |
|
641 bool EapWizardPrivate::storeInnerTypeSettings(EapQtPluginHandle &outerType) |
|
642 { |
|
643 bool ret = true; |
|
644 |
|
645 if (hasInnerMethod()) { |
|
646 EapQtPluginHandle inner = static_cast<EapQtPluginHandle::Plugin>( |
|
647 configurations(InnerType).toInt()); |
|
648 |
|
649 // All inner methods supported by wizard use password / username. |
|
650 EapQtConfig eapConfInner; |
|
651 eapConfInner.setValue(EapQtConfig::OuterType, qVariantFromValue(outerType)); |
|
652 eapConfInner.setValue(EapQtConfig::UsernameAutomatic, false); |
|
653 eapConfInner.setValue(EapQtConfig::Username, configurations(Username)); |
|
654 eapConfInner.setValue(EapQtConfig::PasswordPrompt, false); |
|
655 eapConfInner.setValue(EapQtConfig::Password, configurations(Password)); |
|
656 |
|
657 if (!mEapConfIf->saveConfiguration(inner, eapConfInner)){ |
|
658 mEapConfIf->deleteConfiguration(); |
|
659 ret = false; |
|
660 } |
|
661 } |
|
662 return ret; |
|
663 } |