mirror of https://github.com/qt/qtgrpc.git
Remove QAbstractGrpcCredentials and QGrpcCredentials
Remove unused parts of old credentials system. QAbstractGrpcCredentials and QGrpcCredentials provided combination class for both Channel and Call. Now, channel and call credentials are used separately in channel and call options. Task-number: QTBUG-111037 Change-Id: Id1e62c249148cb9bc1a66050308c23fdbae19735 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
aed606e6cb
commit
9592fb0caa
|
|
@ -10,7 +10,6 @@ qt_internal_add_module(Grpc
|
|||
qabstractgrpcchannel.h qabstractgrpcchannel_p.h qabstractgrpcchannel.cpp
|
||||
qgrpchttp2channel.h qgrpchttp2channel.cpp
|
||||
qabstractgrpcclient.h qabstractgrpcclient.cpp
|
||||
qabstractgrpccredentials.h qabstractgrpccredentials.cpp
|
||||
qgrpccredentials.h qgrpccredentials.cpp
|
||||
qgrpcuserpasswordcredentials.h qgrpcuserpasswordcredentials.cpp
|
||||
qgrpccalloptions.h qgrpccalloptions.cpp
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
||||
|
||||
#include "qabstractgrpccredentials.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QAbstractGrpcCredentials
|
||||
\inmodule QtGrpc
|
||||
\brief The QAbstractGrpcClient is an abstract storage class used by authentication parameters.
|
||||
|
||||
QAbstractGrpcCredentials provides a set of functions to access the call and
|
||||
the channel credentials that are used by gRPC channels to communicate with the services.
|
||||
|
||||
You may implement this interface to create your own authentication provider class, but we
|
||||
recommend using the QGrpcCredentials with QGrpcUserPasswordCredentials and QGrpcSslCredentials.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\typealias QGrpcCredentialMap
|
||||
\relates QAbstractGrpcCredentials
|
||||
|
||||
Alias for \c{QMap<QByteArray, QVariant>}.
|
||||
This is the key-value map of credentials, such as user-password credentials
|
||||
or session parameters.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QGrpcCredentialMap QAbstractGrpcCredentials::callCredentials() const = 0
|
||||
|
||||
This pure virtual function returns a key-value map of the credentials for RPC calls.
|
||||
|
||||
This function is called to obtain the QGrpcCredentialMap for the call.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QGrpcCredentialMap QAbstractGrpcCredentials::channelCredentials() const = 0
|
||||
|
||||
This pure virtual function shall return a key-value map of session parameters
|
||||
for the specific channel.
|
||||
|
||||
This function is called to obtain the QGrpcCredentialMap for the channel.
|
||||
*/
|
||||
|
||||
QAbstractGrpcCredentials::~QAbstractGrpcCredentials() = default;
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
||||
|
||||
#ifndef QABSTRACTGRPCCREDENTIALS_H
|
||||
#define QABSTRACTGRPCCREDENTIALS_H
|
||||
|
||||
#include <QtGrpc/qtgrpcglobal.h>
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/qbytearray.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
using QGrpcCredentialMap = QMap<QByteArray, QVariant>;
|
||||
|
||||
class Q_GRPC_EXPORT QAbstractGrpcCredentials
|
||||
{
|
||||
public:
|
||||
virtual ~QAbstractGrpcCredentials();
|
||||
virtual QGrpcCredentialMap callCredentials() const = 0;
|
||||
virtual QGrpcCredentialMap channelCredentials() const = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QABSTRACTGRPCCREDENTIALS_H
|
||||
|
|
@ -7,7 +7,6 @@
|
|||
#include <QtCore/QThread>
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
#include <QtGrpc/qabstractgrpcclient.h>
|
||||
#include <QtGrpc/qabstractgrpccredentials.h>
|
||||
#include <QtGrpc/qgrpccredentials.h>
|
||||
#include <QtProtobuf/QProtobufSerializer>
|
||||
#include <qtgrpcglobal_p.h>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QAbstractGrpcCredentials;
|
||||
struct QGrpcChannelPrivate;
|
||||
|
||||
class Q_GRPC_EXPORT QGrpcChannel final : public QAbstractGrpcChannel
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
//
|
||||
|
||||
#include <QtGrpc/qabstractgrpcclient.h>
|
||||
#include <QtGrpc/qabstractgrpccredentials.h>
|
||||
#include <QtGrpc/qgrpccallreply.h>
|
||||
#include <QtGrpc/qgrpcchannel.h>
|
||||
#include <QtGrpc/qgrpccredentials.h>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,16 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\typealias QGrpcCredentialMap
|
||||
\relates QGrpcCallCredentials
|
||||
\relates QGrpcChannelCredentials
|
||||
|
||||
Alias for \c{QMap<QByteArray, QVariant>}.
|
||||
This is the key-value map of credentials, such as user-password credentials
|
||||
or session parameters.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QGrpcCallCredentials
|
||||
\inmodule QtGrpc
|
||||
|
|
@ -51,60 +61,6 @@ QT_BEGIN_NAMESPACE
|
|||
This function is called to obtain the QGrpcCredentialMap for the channel.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QGrpcCredentials
|
||||
\inmodule QtGrpc
|
||||
|
||||
\brief The QGrpcCredentials class is a combination of call
|
||||
and channel credentials that is used by gRPC channels to communicate
|
||||
with services, using the given authentication parameters.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn template <typename Call, typename Channel> QGrpcCredentials<Call, Channel>::QGrpcCredentials(const Call &call,
|
||||
const Channel &channel)
|
||||
|
||||
Constructs QGrpcCredentials with \a call and \a channel credentials.
|
||||
The Call type must be the base of QGrpcCallCredentials and
|
||||
the Channel type must be the base of QGrpcChannelCredentials.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn template <typename Call, typename Channel> QGrpcCredentials<Call, Channel>::QGrpcCredentials(const Call &call)
|
||||
|
||||
Constructs QGrpcCredentials with \a call credentials.
|
||||
The Call type must be the base of QGrpcCallCredentials.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn template <typename Call, typename Channel> QGrpcCredentials<Call, Channel>::QGrpcCredentials(const Channel &channel)
|
||||
|
||||
Constructs QGrpcCredentials with \a channel credentials.
|
||||
The Channel type must be the base of QGrpcChannelCredentials.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn template <typename Call, typename Channel> QGrpcCredentials<Call, Channel>::~QGrpcCredentials()
|
||||
|
||||
Destroys the QGrpcCredentials object.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn template <typename Call, typename Channel> QGrpcCredentialMap QGrpcCredentials<Call, Channel>::callCredentials() const
|
||||
|
||||
Returns a map of call credentials by calling QGrpcCallCredentials::operator()
|
||||
on a stored Call object.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn template <typename Call, typename Channel> QGrpcCredentialMap QGrpcCredentials<Call, Channel>::channelCredentials() const
|
||||
|
||||
Returns a map of channel credentials by calling QGrpcChannelCredentials::channelCredentials()
|
||||
on a stored Channel object.
|
||||
*/
|
||||
|
||||
const char *SslConfigCredential = "sslConfig";
|
||||
|
||||
QGrpcCallCredentials::~QGrpcCallCredentials() = default;
|
||||
|
||||
QGrpcChannelCredentials::~QGrpcChannelCredentials() = default;
|
||||
|
|
|
|||
|
|
@ -5,13 +5,16 @@
|
|||
#ifndef QGRPCCREDENTIALS_H
|
||||
#define QGRPCCREDENTIALS_H
|
||||
|
||||
#include <QtGrpc/qabstractgrpccredentials.h>
|
||||
#include <QtGrpc/qtgrpcglobal.h>
|
||||
|
||||
#include <type_traits>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using QGrpcCredentialMap = QMap<QByteArray, QVariant>;
|
||||
|
||||
class Q_GRPC_EXPORT QGrpcCallCredentials
|
||||
{
|
||||
public:
|
||||
|
|
@ -26,59 +29,6 @@ public:
|
|||
virtual QGrpcCredentialMap channelCredentials() const = 0;
|
||||
};
|
||||
|
||||
#ifdef Q_QDOC
|
||||
template <typename Call, typename Channel>
|
||||
#else
|
||||
template <typename Call, typename Channel,
|
||||
typename std::enable_if_t<
|
||||
std::conjunction_v<std::is_base_of<QGrpcCallCredentials, Call>,
|
||||
std::is_base_of<QGrpcChannelCredentials, Channel>>,
|
||||
int> = 0>
|
||||
#endif
|
||||
class QGrpcCredentials final : public QAbstractGrpcCredentials
|
||||
{
|
||||
public:
|
||||
explicit QGrpcCredentials(const Call &call, const Channel &channel)
|
||||
: mCall(call), mChannel(channel)
|
||||
{
|
||||
}
|
||||
explicit QGrpcCredentials(const Call &call) : mCall(call) { }
|
||||
explicit QGrpcCredentials(const Channel &channel) : mChannel(channel) { }
|
||||
~QGrpcCredentials() override = default;
|
||||
|
||||
QGrpcCredentialMap callCredentials() const override { return mCall(); }
|
||||
|
||||
QGrpcCredentialMap channelCredentials() const override { return mChannel.channelCredentials(); }
|
||||
|
||||
private:
|
||||
QGrpcCredentials() = default;
|
||||
|
||||
Call mCall;
|
||||
Channel mChannel;
|
||||
};
|
||||
|
||||
extern Q_GRPC_EXPORT const char *SslConfigCredential;
|
||||
|
||||
template <typename Call, typename Channel,
|
||||
typename std::enable_if_t<
|
||||
std::conjunction_v<std::is_base_of<QGrpcCallCredentials, Call>,
|
||||
std::is_base_of<QGrpcChannelCredentials, Channel>>,
|
||||
int> = 0>
|
||||
std::unique_ptr<QAbstractGrpcCredentials> operator|(const Call &call, const Channel &channel)
|
||||
{
|
||||
return std::make_unique<QGrpcCredentials<Call, Channel>>(call, channel);
|
||||
}
|
||||
|
||||
template <typename Call, typename Channel,
|
||||
typename std::enable_if_t<
|
||||
std::conjunction_v<std::is_base_of<QGrpcCallCredentials, Call>,
|
||||
std::is_base_of<QGrpcChannelCredentials, Channel>>,
|
||||
int> = 0>
|
||||
std::unique_ptr<QAbstractGrpcCredentials> operator|(const Channel &channel, const Call &call)
|
||||
{
|
||||
return std::make_unique<QGrpcCredentials<Call, Channel>>(call, channel);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QGRPCCREDENTIALS_H
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QAbstractGrpcCredentials;
|
||||
struct QGrpcHttp2ChannelPrivate;
|
||||
|
||||
class Q_GRPC_EXPORT QGrpcHttp2Channel final : public QAbstractGrpcChannel
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#if QT_CONFIG(native_grpc)
|
||||
# include <QGrpcChannel>
|
||||
#endif
|
||||
#include <QGrpcCredentials>
|
||||
#include <QGrpcHttp2Channel>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
|
|
|||
Loading…
Reference in New Issue