mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
70
src/blackcore/db/databaseauthentication.h
Normal file
70
src/blackcore/db/databaseauthentication.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKCORE_DATABASE_CDATABASEUATHENTICATIONSERVICE_H
|
||||
#define BLACKCORE_DATABASE_CDATABASEUATHENTICATIONSERVICE_H
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackcore/data/authenticateduser.h"
|
||||
#include "blackmisc/datacache.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class QNetworkReply;
|
||||
namespace BlackMisc { namespace Network { class CAuthenticatedUser; } }
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
namespace Db
|
||||
{
|
||||
//! Databse user used with swift DB. Features role and cookie handling.
|
||||
class BLACKCORE_EXPORT CDatabaseAuthenticationService: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
CDatabaseAuthenticationService(QObject *parent = nullptr);
|
||||
|
||||
//! Shutdown
|
||||
void gracefulShutdown();
|
||||
|
||||
public slots:
|
||||
//! Try to login to authentication web service
|
||||
BlackMisc::CStatusMessageList login(const QString &id, const QString &password);
|
||||
|
||||
//! Logoff
|
||||
void logoff();
|
||||
|
||||
signals:
|
||||
//! User authenticated
|
||||
void userAuthenticationFinished(const BlackMisc::Network::CAuthenticatedUser &user, const BlackMisc::CStatusMessageList &loginStatus);
|
||||
|
||||
//! Logoff completed
|
||||
void logoffFinished();
|
||||
|
||||
private slots:
|
||||
//! Parse login answer
|
||||
void ps_parseServerResponse(QNetworkReply *nwReplyPtr);
|
||||
|
||||
//! User object changed
|
||||
void ps_userChanged();
|
||||
|
||||
private:
|
||||
BlackMisc::CData<BlackCore::Data::AuthenticatedDbUser> m_swiftDbUser {this, &CDatabaseAuthenticationService::ps_userChanged};
|
||||
bool m_shutdown = false;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user