libsolidcontrol
authentication.cpp
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2006 Kevin Ottens <ervin@kde.org> 00003 Copyright (C) 2006,2007 Will Stephenson <wstephenson@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 00019 */ 00020 00021 #include "soliddefs_p.h" 00022 #include "authentication.h" 00023 #include "networkmanager_p.h" 00024 #include <solid/control/networkmanager.h> 00025 #include <solid/control/ifaces/networkmanager.h> 00026 #include <solid/control/ifaces/authentication.h> 00027 00028 namespace Solid 00029 { 00030 namespace Control 00031 { 00032 class AuthenticationValidator::Private 00033 { 00034 public: 00035 QObject *backendObject; 00036 }; 00037 00038 class Authentication::Private 00039 { 00040 public: 00041 SecretMap secrets; 00042 }; 00043 00044 class AuthenticationWep::Private 00045 { 00046 public: 00047 WepMethod method; 00048 WepType type; 00049 int keyLength; 00050 }; 00051 00052 class AuthenticationWpa::Private 00053 { 00054 public: 00055 WpaProtocol protocol; 00056 WpaVersion version; 00057 WpaKeyManagement mgmt; 00058 }; 00059 00060 class AuthenticationWpaEnterprise::Private 00061 { 00062 public: 00063 QString identity; 00064 QString anonIdentity; 00065 QString certClient; 00066 QString certCA; 00067 QString certPrivate; 00068 EapMethod method; 00069 QString idPasswordKey; 00070 QString certPrivatePasswordKey; 00071 }; 00072 } 00073 } 00074 00075 00076 /******************************************************************************/ 00077 00078 Solid::Control::Authentication::Authentication() 00079 : d(new Private) 00080 { 00081 00082 } 00083 00084 Solid::Control::Authentication::~Authentication() 00085 { 00086 delete d; 00087 } 00088 00089 void Solid::Control::Authentication::setSecrets(const SecretMap &secrets) 00090 { 00091 d->secrets = secrets; 00092 } 00093 00094 Solid::Control::Authentication::SecretMap Solid::Control::Authentication::secrets() const 00095 { 00096 return d->secrets; 00097 } 00098 00099 00100 00101 /******************************************************************************/ 00102 00103 Solid::Control::AuthenticationNone::AuthenticationNone() 00104 : d(0) 00105 { 00106 00107 } 00108 00109 Solid::Control::AuthenticationNone::~AuthenticationNone() 00110 { 00111 00112 } 00113 00114 00115 00116 /******************************************************************************/ 00117 00118 Solid::Control::AuthenticationWep::AuthenticationWep() 00119 : d(new Private) 00120 { 00121 00122 } 00123 00124 Solid::Control::AuthenticationWep::~AuthenticationWep() 00125 { 00126 delete d; 00127 } 00128 00129 void Solid::Control::AuthenticationWep::setMethod(WepMethod method) 00130 { 00131 d->method = method; 00132 } 00133 00134 Solid::Control::AuthenticationWep::WepMethod Solid::Control::AuthenticationWep::method() const 00135 { 00136 return d->method; 00137 } 00138 00139 void Solid::Control::AuthenticationWep::setType(WepType type) 00140 { 00141 d->type = type; 00142 } 00143 00144 Solid::Control::AuthenticationWep::WepType Solid::Control::AuthenticationWep::type() const 00145 { 00146 return d->type; 00147 } 00148 00149 void Solid::Control::AuthenticationWep::setKeyLength(int length) 00150 { 00151 d->keyLength = length; 00152 } 00153 00154 int Solid::Control::AuthenticationWep::keyLength() const 00155 { 00156 return d->keyLength; 00157 } 00158 00159 /******************************************************************************/ 00160 00161 Solid::Control::AuthenticationWpa::AuthenticationWpa() 00162 : d(new Private) 00163 { 00164 00165 } 00166 00167 Solid::Control::AuthenticationWpa::~AuthenticationWpa() 00168 { 00169 delete d; 00170 } 00171 00172 void Solid::Control::AuthenticationWpa::setProtocol(WpaProtocol protocol) 00173 { 00174 d->protocol = protocol; 00175 } 00176 00177 Solid::Control::AuthenticationWpa::WpaProtocol Solid::Control::AuthenticationWpa::protocol() const 00178 { 00179 return d->protocol; 00180 } 00181 00182 void Solid::Control::AuthenticationWpa::setVersion(WpaVersion version) 00183 { 00184 d->version = version; 00185 } 00186 00187 Solid::Control::AuthenticationWpa::WpaVersion Solid::Control::AuthenticationWpa::version() const 00188 { 00189 return d->version; 00190 } 00191 00192 void Solid::Control::AuthenticationWpa::setKeyManagement(WpaKeyManagement mgmt) 00193 { 00194 d->mgmt = mgmt; 00195 } 00196 00197 Solid::Control::AuthenticationWpa::WpaKeyManagement Solid::Control::AuthenticationWpa::keyManagement() const 00198 { 00199 return d->mgmt; 00200 } 00201 00202 /******************************************************************************/ 00203 00204 Solid::Control::AuthenticationWpaPersonal::AuthenticationWpaPersonal() 00205 : d(0) 00206 { 00207 00208 } 00209 00210 Solid::Control::AuthenticationWpaPersonal::~AuthenticationWpaPersonal() 00211 { 00212 00213 } 00214 00215 00216 00217 /******************************************************************************/ 00218 00219 Solid::Control::AuthenticationWpaEnterprise::AuthenticationWpaEnterprise() 00220 : d(new Private) 00221 { 00222 00223 } 00224 00225 Solid::Control::AuthenticationWpaEnterprise::~AuthenticationWpaEnterprise() 00226 { 00227 delete d; 00228 } 00229 00230 void Solid::Control::AuthenticationWpaEnterprise::setIdentity(const QString &identity) 00231 { 00232 d->identity = identity; 00233 } 00234 00235 QString Solid::Control::AuthenticationWpaEnterprise::identity() const 00236 { 00237 return d->identity; 00238 } 00239 00240 void Solid::Control::AuthenticationWpaEnterprise::setAnonIdentity(const QString &anonIdentity) 00241 { 00242 d->anonIdentity = anonIdentity; 00243 } 00244 00245 QString Solid::Control::AuthenticationWpaEnterprise::anonIdentity() const 00246 { 00247 return d->anonIdentity; 00248 } 00249 00250 void Solid::Control::AuthenticationWpaEnterprise::setCertClient(const QString &certClient) 00251 { 00252 d->certClient = certClient; 00253 } 00254 00255 QString Solid::Control::AuthenticationWpaEnterprise::certClient() const 00256 { 00257 return d->certClient; 00258 } 00259 00260 void Solid::Control::AuthenticationWpaEnterprise::setCertCA(const QString &certCA) 00261 { 00262 d->certCA = certCA; 00263 } 00264 00265 QString Solid::Control::AuthenticationWpaEnterprise::certCA() const 00266 { 00267 return d->certCA; 00268 } 00269 00270 void Solid::Control::AuthenticationWpaEnterprise::setCertPrivate(const QString &certPrivate) 00271 { 00272 d->certPrivate = certPrivate; 00273 } 00274 00275 QString Solid::Control::AuthenticationWpaEnterprise::certPrivate() const 00276 { 00277 return d->certPrivate; 00278 } 00279 00280 00281 void Solid::Control::AuthenticationWpaEnterprise::setMethod(EapMethod method) 00282 { 00283 d->method = method; 00284 } 00285 00286 Solid::Control::AuthenticationWpaEnterprise::EapMethod Solid::Control::AuthenticationWpaEnterprise::method() const 00287 { 00288 return d->method; 00289 } 00290 00291 void Solid::Control::AuthenticationWpaEnterprise::setIdPasswordKey(const QString &idPasswordKey) 00292 { 00293 d->idPasswordKey = idPasswordKey; 00294 } 00295 00296 QString Solid::Control::AuthenticationWpaEnterprise::idPasswordKey() const 00297 { 00298 return d->idPasswordKey; 00299 } 00300 00301 void Solid::Control::AuthenticationWpaEnterprise::setCertPrivatePasswordKey(const QString &certPrivatePasswordKey) 00302 { 00303 d->certPrivatePasswordKey = certPrivatePasswordKey; 00304 } 00305 00306 QString Solid::Control::AuthenticationWpaEnterprise::certPrivatePasswordKey() const 00307 { 00308 return d->certPrivatePasswordKey; 00309 } 00310 00311 00312 00313 Solid::Control::AuthenticationValidator::AuthenticationValidator() 00314 : d(new Private) 00315 { 00316 #if 0 00317 Ifaces::NetworkManager *backend = qobject_cast<Ifaces::NetworkManager *>(NetworkManager::self().d->managerBackend()); 00318 00319 if (backend) 00320 { 00321 d->backendObject = backend->createAuthenticationValidator(); 00322 } 00323 #endif 00324 } 00325 00326 Solid::Control::AuthenticationValidator::~AuthenticationValidator() 00327 { 00328 delete d->backendObject; 00329 delete d; 00330 } 00331 00332 bool Solid::Control::AuthenticationValidator::validate(const Solid::Control::Authentication *authentication) 00333 { 00334 return_SOLID_CALL(Ifaces::AuthenticationValidator *, d->backendObject, false, validate(authentication)); 00335 } 00336