mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
Other: implemented tokens in bridge-gui-tester.
This commit is contained in:
@ -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.
|
||||
|
||||
Reference in New Issue
Block a user