signon 8.54

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

default-secrets-storage.h
Go to the documentation of this file.
1 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of signon
4 *
5 * Copyright (C) 2011 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 */
23
30 #ifndef SIGNON_DEFAULT_SECRETS_STORAGE_H
31 #define SIGNON_DEFAULT_SECRETS_STORAGE_H
32
33 #include "SignOn/abstract-secrets-storage.h"
34 #include "credentialsdb.h"
35 #include "credentialsdb_p.h"
36
37 #include <QObject>
38
39 namespace SignonDaemonNS {
40
41 class SecretsDB: public SqlDatabase
42 {
43 friend class ::TestDatabase;
44 public:
45 SecretsDB(const QString &name):
46 SqlDatabase(name, QLatin1String("SSO-secrets"), SSO_SECRETSDB_VERSION) {}
47
48 bool createTables();
49 bool clear();
50
51 bool updateCredentials(const quint32 id,
52 const QString &username,
53 const QString &password);
54 bool removeCredentials(const quint32 id);
55 bool loadCredentials(const quint32 id,
56 QString &username,
57 QString &password);
58
59 QVariantMap loadData(quint32 id, quint32 method);
60 bool storeData(quint32 id, quint32 method, const QVariantMap &data);
61 bool removeData(quint32 id, quint32 method);
62 };
63
64
73 class DefaultSecretsStorage: public SignOn::AbstractSecretsStorage
74 {
75 Q_OBJECT
76
77 public:
78 explicit DefaultSecretsStorage(QObject *parent = 0);
79 ~DefaultSecretsStorage();
80
81 /* reimplemented virtual methods */
82 bool initialize(const QVariantMap &configuration);
83 bool close();
84 bool clear();
85 bool updateCredentials(const quint32 id,
86 const QString &username,
87 const QString &password);
88 bool removeCredentials(const quint32 id);
89 bool loadCredentials(const quint32 id,
90 QString &username,
91 QString &password);
92 QVariantMap loadData(quint32 id, quint32 method);
93 bool storeData(quint32 id, quint32 method, const QVariantMap &data);
94 bool removeData(quint32 id, quint32 method);
95
96 private:
97 SecretsDB *m_secretsDB;
98 };
99
100 } //namespace
101
102 #endif // SIGNON_DEFAULT_SECRETS_STORAGE_H
SignonDaemonNS::SqlDatabase::password
QString password() const
Definition: credentialsdb_p.h:167
SignonDaemonNS::SecretsDB::updateCredentials
bool updateCredentials(const quint32 id, const QString &username, const QString &password)
Definition: default-secrets-storage.cpp:88
SignonDaemonNS::DefaultSecretsStorage::removeData
bool removeData(quint32 id, quint32 method)
Definition: default-secrets-storage.cpp:363
SignonDaemonNS::DefaultSecretsStorage::updateCredentials
bool updateCredentials(const quint32 id, const QString &username, const QString &password)
Definition: default-secrets-storage.cpp:323
SignonDaemonNS::DefaultSecretsStorage::close
bool close()
Definition: default-secrets-storage.cpp:305
SignonDaemonNS::DefaultSecretsStorage::DefaultSecretsStorage
DefaultSecretsStorage(QObject *parent=0)
Definition: default-secrets-storage.cpp:274
credentialsdb.h
Definition of the CredentialsDB object.
SignonDaemonNS::SecretsDB::removeData
bool removeData(quint32 id, quint32 method)
Definition: default-secrets-storage.cpp:245
SignonDaemonNS::DefaultSecretsStorage::removeCredentials
bool removeCredentials(const quint32 id)
Definition: default-secrets-storage.cpp:332
SSO_SECRETSDB_VERSION
#define SSO_SECRETSDB_VERSION
Definition: credentialsdb_p.h:35
SignonDaemonNS::SecretsDB::loadData
QVariantMap loadData(quint32 id, quint32 method)
Definition: default-secrets-storage.cpp:150
SignonDaemonNS::SecretsDB::storeData
bool storeData(quint32 id, quint32 method, const QVariantMap &data)
Definition: default-secrets-storage.cpp:175
SignonDaemonNS::DefaultSecretsStorage::storeData
bool storeData(quint32 id, quint32 method, const QVariantMap &data)
Definition: default-secrets-storage.cpp:355
SignonDaemonNS::DefaultSecretsStorage::~DefaultSecretsStorage
~DefaultSecretsStorage()
Definition: default-secrets-storage.cpp:279
SignonDaemonNS::DefaultSecretsStorage::initialize
bool initialize(const QVariantMap &configuration)
Definition: default-secrets-storage.cpp:284
SignonDaemonNS::SecretsDB::removeCredentials
bool removeCredentials(const quint32 id)
Definition: default-secrets-storage.cpp:117
SignonDaemonNS::SecretsDB
Definition: default-secrets-storage.h:41
SignonDaemonNS::SecretsDB::clear
bool clear()
Definition: default-secrets-storage.cpp:77
SignonDaemonNS::SecretsDB::SecretsDB
SecretsDB(const QString &name)
Definition: default-secrets-storage.h:45
SignonDaemonNS::DefaultSecretsStorage::loadData
QVariantMap loadData(quint32 id, quint32 method)
Definition: default-secrets-storage.cpp:348
SignonDaemonNS::DefaultSecretsStorage::loadCredentials
bool loadCredentials(const quint32 id, QString &username, QString &password)
Definition: default-secrets-storage.cpp:339
SignonDaemonNS::DefaultSecretsStorage
SQLite-based implementation of the AbstractSecretsStorage interface.
Definition: default-secrets-storage.h:73
SignonDaemonNS::SecretsDB::loadCredentials
bool loadCredentials(const quint32 id, QString &username, QString &password)
Definition: default-secrets-storage.cpp:130
SignonDaemonNS::SqlDatabase::username
QString username() const
Definition: credentialsdb_p.h:162
SignonDaemonNS::DefaultSecretsStorage::clear
bool clear()
Definition: default-secrets-storage.cpp:316
SignonDaemonNS::SecretsDB::createTables
bool createTables()
Definition: default-secrets-storage.cpp:39
credentialsdb_p.h
SignonDaemonNS::SqlDatabase
Will be used manage the SQL database interaction.
Definition: credentialsdb_p.h:86