1 /* This file is part of the KDE project
2 Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
3 Copyright (C) 2006,2007 Will Stephenson <wstephenson@kde.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #include "soliddefs_p.h"
22 #include "authentication.h"
23 #include "networkmanager_p.h"
24 #include <solid/control/networkmanager.h>
25 #include <solid/control/ifaces/networkmanager.h>
26 #include <solid/control/ifaces/authentication.h>
32 class AuthenticationValidator::Private
35 QObject
*backendObject
;
38 class Authentication::Private
44 class AuthenticationWep::Private
52 class AuthenticationWpa::Private
57 WpaKeyManagement mgmt
;
60 class AuthenticationWpaEnterprise::Private
69 QString idPasswordKey
;
70 QString certPrivatePasswordKey
;
76 /******************************************************************************/
78 Solid::Control::Authentication::Authentication()
84 Solid::Control::Authentication::~Authentication()
89 void Solid::Control::Authentication::setSecrets(const SecretMap
&secrets
)
94 Solid::Control::Authentication::SecretMap
Solid::Control::Authentication::secrets() const
101 /******************************************************************************/
103 Solid::Control::AuthenticationNone::AuthenticationNone()
109 Solid::Control::AuthenticationNone::~AuthenticationNone()
116 /******************************************************************************/
118 Solid::Control::AuthenticationWep::AuthenticationWep()
124 Solid::Control::AuthenticationWep::~AuthenticationWep()
129 void Solid::Control::AuthenticationWep::setMethod(WepMethod method
)
134 Solid::Control::AuthenticationWep::WepMethod
Solid::Control::AuthenticationWep::method() const
139 void Solid::Control::AuthenticationWep::setType(WepType type
)
144 Solid::Control::AuthenticationWep::WepType
Solid::Control::AuthenticationWep::type() const
149 void Solid::Control::AuthenticationWep::setKeyLength(int length
)
151 d
->keyLength
= length
;
154 int Solid::Control::AuthenticationWep::keyLength() const
159 /******************************************************************************/
161 Solid::Control::AuthenticationWpa::AuthenticationWpa()
167 Solid::Control::AuthenticationWpa::~AuthenticationWpa()
172 void Solid::Control::AuthenticationWpa::setProtocol(WpaProtocol protocol
)
174 d
->protocol
= protocol
;
177 Solid::Control::AuthenticationWpa::WpaProtocol
Solid::Control::AuthenticationWpa::protocol() const
182 void Solid::Control::AuthenticationWpa::setVersion(WpaVersion version
)
184 d
->version
= version
;
187 Solid::Control::AuthenticationWpa::WpaVersion
Solid::Control::AuthenticationWpa::version() const
192 void Solid::Control::AuthenticationWpa::setKeyManagement(WpaKeyManagement mgmt
)
197 Solid::Control::AuthenticationWpa::WpaKeyManagement
Solid::Control::AuthenticationWpa::keyManagement() const
202 /******************************************************************************/
204 Solid::Control::AuthenticationWpaPersonal::AuthenticationWpaPersonal()
210 Solid::Control::AuthenticationWpaPersonal::~AuthenticationWpaPersonal()
217 /******************************************************************************/
219 Solid::Control::AuthenticationWpaEnterprise::AuthenticationWpaEnterprise()
225 Solid::Control::AuthenticationWpaEnterprise::~AuthenticationWpaEnterprise()
230 void Solid::Control::AuthenticationWpaEnterprise::setIdentity(const QString
&identity
)
232 d
->identity
= identity
;
235 QString
Solid::Control::AuthenticationWpaEnterprise::identity() const
240 void Solid::Control::AuthenticationWpaEnterprise::setAnonIdentity(const QString
&anonIdentity
)
242 d
->anonIdentity
= anonIdentity
;
245 QString
Solid::Control::AuthenticationWpaEnterprise::anonIdentity() const
247 return d
->anonIdentity
;
250 void Solid::Control::AuthenticationWpaEnterprise::setCertClient(const QString
&certClient
)
252 d
->certClient
= certClient
;
255 QString
Solid::Control::AuthenticationWpaEnterprise::certClient() const
257 return d
->certClient
;
260 void Solid::Control::AuthenticationWpaEnterprise::setCertCA(const QString
&certCA
)
265 QString
Solid::Control::AuthenticationWpaEnterprise::certCA() const
270 void Solid::Control::AuthenticationWpaEnterprise::setCertPrivate(const QString
&certPrivate
)
272 d
->certPrivate
= certPrivate
;
275 QString
Solid::Control::AuthenticationWpaEnterprise::certPrivate() const
277 return d
->certPrivate
;
281 void Solid::Control::AuthenticationWpaEnterprise::setMethod(EapMethod method
)
286 Solid::Control::AuthenticationWpaEnterprise::EapMethod
Solid::Control::AuthenticationWpaEnterprise::method() const
291 void Solid::Control::AuthenticationWpaEnterprise::setIdPasswordKey(const QString
&idPasswordKey
)
293 d
->idPasswordKey
= idPasswordKey
;
296 QString
Solid::Control::AuthenticationWpaEnterprise::idPasswordKey() const
298 return d
->idPasswordKey
;
301 void Solid::Control::AuthenticationWpaEnterprise::setCertPrivatePasswordKey(const QString
&certPrivatePasswordKey
)
303 d
->certPrivatePasswordKey
= certPrivatePasswordKey
;
306 QString
Solid::Control::AuthenticationWpaEnterprise::certPrivatePasswordKey() const
308 return d
->certPrivatePasswordKey
;
313 Solid::Control::AuthenticationValidator::AuthenticationValidator()
317 Ifaces::NetworkManager
*backend
= qobject_cast
<Ifaces::NetworkManager
*>(NetworkManager::self().d
->managerBackend());
321 d
->backendObject
= backend
->createAuthenticationValidator();
326 Solid::Control::AuthenticationValidator::~AuthenticationValidator()
328 delete d
->backendObject
;
332 bool Solid::Control::AuthenticationValidator::validate(const Solid::Control::Authentication
*authentication
)
334 return_SOLID_CALL(Ifaces::AuthenticationValidator
*, d
->backendObject
, false, validate(authentication
));