mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
71 lines
2.2 KiB
C++
71 lines
2.2 KiB
C++
/* 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::TAuthenticatedDbUser> m_swiftDbUser {this, &CDatabaseAuthenticationService::ps_userChanged};
|
|
bool m_shutdown = false;
|
|
};
|
|
} // ns
|
|
} // ns
|
|
|
|
#endif // guard
|