~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/solid/control/authentication.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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>
 
4
 
 
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.
 
8
 
 
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.
 
13
 
 
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.
 
18
 
 
19
*/
 
20
 
 
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>
 
27
 
 
28
namespace Solid
 
29
{
 
30
namespace Control
 
31
{
 
32
    class AuthenticationValidator::Private
 
33
    {
 
34
    public:
 
35
        QObject *backendObject;
 
36
    };
 
37
 
 
38
    class Authentication::Private
 
39
    {
 
40
    public:
 
41
        SecretMap secrets;
 
42
    };
 
43
 
 
44
    class AuthenticationWep::Private
 
45
    {
 
46
    public:
 
47
        WepMethod method;
 
48
        WepType type;
 
49
        int keyLength;
 
50
    };
 
51
 
 
52
    class AuthenticationWpa::Private
 
53
    {
 
54
    public:
 
55
        WpaProtocol protocol;
 
56
        WpaVersion version;
 
57
        WpaKeyManagement mgmt;
 
58
    };
 
59
 
 
60
    class AuthenticationWpaEnterprise::Private
 
61
    {
 
62
    public:
 
63
        QString identity;
 
64
        QString anonIdentity;
 
65
        QString certClient;
 
66
        QString certCA;
 
67
        QString certPrivate;
 
68
        EapMethod method;
 
69
        QString idPasswordKey;
 
70
        QString certPrivatePasswordKey;
 
71
    };
 
72
}
 
73
}
 
74
 
 
75
 
 
76
/******************************************************************************/
 
77
 
 
78
Solid::Control::Authentication::Authentication()
 
79
    : d(new Private)
 
80
{
 
81
 
 
82
}
 
83
 
 
84
Solid::Control::Authentication::~Authentication()
 
85
{
 
86
    delete d;
 
87
}
 
88
 
 
89
void Solid::Control::Authentication::setSecrets(const SecretMap &secrets)
 
90
{
 
91
    d->secrets = secrets;
 
92
}
 
93
 
 
94
Solid::Control::Authentication::SecretMap Solid::Control::Authentication::secrets() const
 
95
{
 
96
    return d->secrets;
 
97
}
 
98
 
 
99
 
 
100
 
 
101
/******************************************************************************/
 
102
 
 
103
Solid::Control::AuthenticationNone::AuthenticationNone()
 
104
    : d(0)
 
105
{
 
106
 
 
107
}
 
108
 
 
109
Solid::Control::AuthenticationNone::~AuthenticationNone()
 
110
{
 
111
 
 
112
}
 
113
 
 
114
 
 
115
 
 
116
/******************************************************************************/
 
117
 
 
118
Solid::Control::AuthenticationWep::AuthenticationWep()
 
119
    : d(new Private)
 
120
{
 
121
 
 
122
}
 
123
 
 
124
Solid::Control::AuthenticationWep::~AuthenticationWep()
 
125
{
 
126
    delete d;
 
127
}
 
128
 
 
129
void Solid::Control::AuthenticationWep::setMethod(WepMethod method)
 
130
{
 
131
    d->method = method;
 
132
}
 
133
 
 
134
Solid::Control::AuthenticationWep::WepMethod Solid::Control::AuthenticationWep::method() const
 
135
{
 
136
    return d->method;
 
137
}
 
138
 
 
139
void Solid::Control::AuthenticationWep::setType(WepType type)
 
140
{
 
141
    d->type = type;
 
142
}
 
143
 
 
144
Solid::Control::AuthenticationWep::WepType Solid::Control::AuthenticationWep::type() const
 
145
{
 
146
    return d->type;
 
147
}
 
148
 
 
149
void Solid::Control::AuthenticationWep::setKeyLength(int length)
 
150
{
 
151
    d->keyLength = length;
 
152
}
 
153
 
 
154
int Solid::Control::AuthenticationWep::keyLength() const
 
155
{
 
156
    return d->keyLength;
 
157
}
 
158
 
 
159
/******************************************************************************/
 
160
 
 
161
Solid::Control::AuthenticationWpa::AuthenticationWpa()
 
162
    : d(new Private)
 
163
{
 
164
 
 
165
}
 
166
 
 
167
Solid::Control::AuthenticationWpa::~AuthenticationWpa()
 
168
{
 
169
    delete d;
 
170
}
 
171
 
 
172
void Solid::Control::AuthenticationWpa::setProtocol(WpaProtocol protocol)
 
173
{
 
174
    d->protocol = protocol;
 
175
}
 
176
 
 
177
Solid::Control::AuthenticationWpa::WpaProtocol Solid::Control::AuthenticationWpa::protocol() const
 
178
{
 
179
    return d->protocol;
 
180
}
 
181
 
 
182
void Solid::Control::AuthenticationWpa::setVersion(WpaVersion version)
 
183
{
 
184
    d->version = version;
 
185
}
 
186
 
 
187
Solid::Control::AuthenticationWpa::WpaVersion Solid::Control::AuthenticationWpa::version() const
 
188
{
 
189
    return d->version;
 
190
}
 
191
 
 
192
void Solid::Control::AuthenticationWpa::setKeyManagement(WpaKeyManagement mgmt)
 
193
{
 
194
    d->mgmt = mgmt;
 
195
}
 
196
 
 
197
Solid::Control::AuthenticationWpa::WpaKeyManagement Solid::Control::AuthenticationWpa::keyManagement() const
 
198
{
 
199
    return d->mgmt;
 
200
}
 
201
 
 
202
/******************************************************************************/
 
203
 
 
204
Solid::Control::AuthenticationWpaPersonal::AuthenticationWpaPersonal()
 
205
    : d(0)
 
206
{
 
207
 
 
208
}
 
209
 
 
210
Solid::Control::AuthenticationWpaPersonal::~AuthenticationWpaPersonal()
 
211
{
 
212
 
 
213
}
 
214
 
 
215
 
 
216
 
 
217
/******************************************************************************/
 
218
 
 
219
Solid::Control::AuthenticationWpaEnterprise::AuthenticationWpaEnterprise()
 
220
    : d(new Private)
 
221
{
 
222
 
 
223
}
 
224
 
 
225
Solid::Control::AuthenticationWpaEnterprise::~AuthenticationWpaEnterprise()
 
226
{
 
227
    delete d;
 
228
}
 
229
 
 
230
void Solid::Control::AuthenticationWpaEnterprise::setIdentity(const QString &identity)
 
231
{
 
232
    d->identity = identity;
 
233
}
 
234
 
 
235
QString Solid::Control::AuthenticationWpaEnterprise::identity() const
 
236
{
 
237
    return d->identity;
 
238
}
 
239
 
 
240
void Solid::Control::AuthenticationWpaEnterprise::setAnonIdentity(const QString &anonIdentity)
 
241
{
 
242
    d->anonIdentity = anonIdentity;
 
243
}
 
244
 
 
245
QString Solid::Control::AuthenticationWpaEnterprise::anonIdentity() const
 
246
{
 
247
    return d->anonIdentity;
 
248
}
 
249
 
 
250
void Solid::Control::AuthenticationWpaEnterprise::setCertClient(const QString &certClient)
 
251
{
 
252
    d->certClient = certClient;
 
253
}
 
254
 
 
255
QString Solid::Control::AuthenticationWpaEnterprise::certClient() const
 
256
{
 
257
    return d->certClient;
 
258
}
 
259
 
 
260
void Solid::Control::AuthenticationWpaEnterprise::setCertCA(const QString &certCA)
 
261
{
 
262
    d->certCA = certCA;
 
263
}
 
264
 
 
265
QString Solid::Control::AuthenticationWpaEnterprise::certCA() const
 
266
{
 
267
    return d->certCA;
 
268
}
 
269
 
 
270
void Solid::Control::AuthenticationWpaEnterprise::setCertPrivate(const QString &certPrivate)
 
271
{
 
272
    d->certPrivate = certPrivate;
 
273
}
 
274
 
 
275
QString Solid::Control::AuthenticationWpaEnterprise::certPrivate() const
 
276
{
 
277
    return d->certPrivate;
 
278
}
 
279
 
 
280
 
 
281
void Solid::Control::AuthenticationWpaEnterprise::setMethod(EapMethod method)
 
282
{
 
283
    d->method = method;
 
284
}
 
285
 
 
286
Solid::Control::AuthenticationWpaEnterprise::EapMethod Solid::Control::AuthenticationWpaEnterprise::method() const
 
287
{
 
288
    return d->method;
 
289
}
 
290
 
 
291
void Solid::Control::AuthenticationWpaEnterprise::setIdPasswordKey(const QString &idPasswordKey)
 
292
{
 
293
    d->idPasswordKey = idPasswordKey;
 
294
}
 
295
 
 
296
QString Solid::Control::AuthenticationWpaEnterprise::idPasswordKey() const
 
297
{
 
298
    return d->idPasswordKey;
 
299
}
 
300
 
 
301
void Solid::Control::AuthenticationWpaEnterprise::setCertPrivatePasswordKey(const QString &certPrivatePasswordKey)
 
302
{
 
303
    d->certPrivatePasswordKey = certPrivatePasswordKey;
 
304
}
 
305
 
 
306
QString Solid::Control::AuthenticationWpaEnterprise::certPrivatePasswordKey() const
 
307
{
 
308
    return d->certPrivatePasswordKey;
 
309
}
 
310
 
 
311
 
 
312
 
 
313
Solid::Control::AuthenticationValidator::AuthenticationValidator()
 
314
    : d(new Private)
 
315
{
 
316
#if 0
 
317
    Ifaces::NetworkManager *backend = qobject_cast<Ifaces::NetworkManager *>(NetworkManager::self().d->managerBackend());
 
318
 
 
319
    if (backend)
 
320
    {
 
321
        d->backendObject = backend->createAuthenticationValidator();
 
322
    }
 
323
#endif
 
324
}
 
325
 
 
326
Solid::Control::AuthenticationValidator::~AuthenticationValidator()
 
327
{
 
328
    delete d->backendObject;
 
329
    delete d;
 
330
}
 
331
 
 
332
bool Solid::Control::AuthenticationValidator::validate(const Solid::Control::Authentication *authentication)
 
333
{
 
334
    return_SOLID_CALL(Ifaces::AuthenticationValidator *, d->backendObject, false, validate(authentication));
 
335
}
 
336