authservice.h
/*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
* Copyright (C) 2012-2016 Canonical Ltd.
*
* Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef AUTHSERVICE_H
#define AUTHSERVICE_H
#include <QObject>
#include <QStringList>
#include <QMap>
#include "libsignoncommon.h"
#include "identityinfo.h"
#include "signonerror.h"
namespace SignOn {
class SIGNON_EXPORT AuthService: public QObject
{
Q_OBJECT
Q_DISABLE_COPY(AuthService)
friend class AuthServiceImpl;
public:
enum ServiceError {
UnknownError = 1,
InternalServerError = 2,
InternalCommunicationError = 3,
PermissionDeniedError = 4,
AuthServiceErr = 100, /* Placeholder to rearrange enumeration */
MethodNotKnownError,
NotAvailableError,
InvalidQueryError
};
typedef enum {
AuthMethod = 0,
Username,
Realm,
Caption
} IdentityFilterCriteria;
class IdentityRegExp
{
public:
IdentityRegExp(const QString &pattern);
IdentityRegExp(const IdentityRegExp &src);
bool isValid() const;
QString pattern() const;
private:
QString m_pattern;
};
public:
typedef QMap<IdentityFilterCriteria, IdentityRegExp> IdentityFilter;
AuthService(QObject *parent = 0);
~AuthService();
void queryMethods();
void queryMechanisms(const QString &method);
void queryIdentities(const IdentityFilter &filter = IdentityFilter());
void clear();
Q_SIGNALS:
void error(const SignOn::Error &err);
void methodsAvailable(const QStringList &methods);
void mechanismsAvailable(const QString &method, const QStringList &mechanisms);
void identities(const QList<SignOn::IdentityInfo> &identityList);
void cleared();
private:
class AuthServiceImpl *impl;
};
} // namespace SignOn
#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