My Project: authservice.h Source File

My Project

authservice.h
1/*
2 * This file is part of signon
3 *
4 * Copyright (C) 2009-2010 Nokia Corporation.
5 * Copyright (C) 2012-2016 Canonical Ltd.
6 *
7 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * version 2.1 as published by the Free Software Foundation.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
28#ifndef AUTHSERVICE_H
29#define AUTHSERVICE_H
30
31#include <QObject>
32#include <QStringList>
33#include <QMap>
34
35#include "libsignoncommon.h"
36#include "identityinfo.h"
37#include "signonerror.h"
38
39namespace SignOn {
40
49 class SIGNON_EXPORT AuthService: public QObject
50{
51 Q_OBJECT
52 Q_DISABLE_COPY(AuthService)
53
54 friend class AuthServiceImpl;
55
56public:
62 enum ServiceError {
63 UnknownError = 1,
64 InternalServerError = 2,
65 InternalCommunicationError = 3,
66 PermissionDeniedError = 4,
67 AuthServiceErr = 100, /* Placeholder to rearrange enumeration */
68 MethodNotKnownError,
69 NotAvailableError,
70 InvalidQueryError
71 };
72
78 typedef enum {
79 AuthMethod = 0,
80 Username,
81 Realm,
82 Caption
83 } IdentityFilterCriteria;
84
92 class IdentityRegExp
93 {
94 public:
99 IdentityRegExp(const QString &pattern);
100
105 IdentityRegExp(const IdentityRegExp &src);
106
111 bool isValid() const;
112
117 QString pattern() const;
118
119 private:
120 QString m_pattern;
121 };
122
123public:
128 typedef QMap<IdentityFilterCriteria, IdentityRegExp> IdentityFilter;
129
134 AuthService(QObject *parent = 0);
135
139 ~AuthService();
140
150 void queryMethods();
151
165 void queryMechanisms(const QString &method);
166
183 void queryIdentities(const IdentityFilter &filter = IdentityFilter());
184
196 void clear();
197
198Q_SIGNALS:
199
210 void error(const SignOn::Error &err);
211
218 void methodsAvailable(const QStringList &methods);
219
227 void mechanismsAvailable(const QString &method, const QStringList &mechanisms);
228
235 void identities(const QList<SignOn::IdentityInfo> &identityList);
236
241 void cleared();
242
243private:
244 class AuthServiceImpl *impl;
245};
246
247} // namespace SignOn
248
249#endif // AUTHSERVICE_H
SignOn::AuthService::IdentityRegExp
The class represents a regular expression.
Definition authservice.h:93
SignOn::AuthService::IdentityRegExp::IdentityRegExp
IdentityRegExp(const IdentityRegExp &src)
Copy constructor, creates a copy of src.
SignOn::AuthService::IdentityRegExp::pattern
QString pattern() const
Returns the pattern of regular expression as string.
SignOn::AuthService::IdentityRegExp::isValid
bool isValid() const
Returns the validity of regular expression.
SignOn::AuthService::IdentityRegExp::IdentityRegExp
IdentityRegExp(const QString &pattern)
Constructor creates an IdentityRegExp, as a specified by pattern.
SignOn::AuthService
Represents signon for client application.
Definition authservice.h:50
SignOn::AuthService::IdentityFilter
QMap< IdentityFilterCriteria, IdentityRegExp > IdentityFilter
Map to hold different filtering options.
Definition authservice.h:128
SignOn::AuthService::cleared
void cleared()
Database is cleared and reset to initial state.
SignOn::AuthService::ServiceError
ServiceError
Codes for errors that may be reported by AuthService objects.
Definition authservice.h:62
SignOn::AuthService::NotAvailableError
@ NotAvailableError
Definition authservice.h:69
SignOn::AuthService::MethodNotKnownError
@ MethodNotKnownError
Definition authservice.h:68
SignOn::AuthService::mechanismsAvailable
void mechanismsAvailable(const QString &method, const QStringList &mechanisms)
Emitted when the list of available mechanisms have been obtained from the service.
SignOn::AuthService::identities
void identities(const QList< SignOn::IdentityInfo > &identityList)
Lists identities available on the server matching query parameters.
SignOn::AuthService::error
void error(const SignOn::Error &err)
Emitted when an error occurs while using the AuthService.
SignOn::AuthService::methodsAvailable
void methodsAvailable(const QStringList &methods)
Emitted when the list of available authentication methods have been obtained from the service.
SignOn::Error
definition for Signon error handling.
Definition signonerror.h:53
SignOn
Definition async-dbus-proxy.cpp:41