Other: implemented tokens in bridge-gui-tester.

This commit is contained in:
Xavier Michelon
2022-10-10 13:19:51 +02:00
parent 6b1d689621
commit 9a3900114b
13 changed files with 287 additions and 29 deletions

View File

@ -20,6 +20,7 @@
#include "MainWindow.h"
#include <bridgepp/BridgeUtils.h>
#include <bridgepp/GRPC/EventFactory.h>
#include <bridgepp/GRPC/GRPCConfig.h>
using namespace grpc;
@ -55,6 +56,28 @@ bool GRPCService::isStreaming() const
}
//****************************************************************************************************************************************************
/// \param[in] request The request.
/// \param[out] response The response.
//****************************************************************************************************************************************************
Status GRPCService::CheckTokens(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::StringValue *response)
{
Log& log = app().log();
log.debug(__FUNCTION__);
GRPCConfig config;
QString error;
if (!config.load(QString::fromStdString(request->value()), &error))
{
QString const err = "Could not load gRPC client config";
log.error(err);
return grpc::Status(StatusCode::UNAUTHENTICATED, err.toStdString());
}
response->set_value(config.token.toStdString());
return grpc::Status::OK;
}
//****************************************************************************************************************************************************
/// \param[in] request the request.
/// \return The status for the call.