mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
HoloLens: RicHoloLensRestClient now has an explicit setter for disabling SSL certificate verification. Removed separate flag for controlling whether debug export to file will be done. Now does the export whenever a folder is specified.
This commit is contained in:
parent
9cbbde3f74
commit
469437f320
@ -18,9 +18,6 @@
|
||||
|
||||
#include "RicHoloLensRestClient.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfTrace.h"
|
||||
|
||||
@ -54,7 +51,8 @@
|
||||
RicHoloLensRestClient::RicHoloLensRestClient(QString serverUrl, QString sessionName, RicHoloLensRestResponseHandler* responseHandler)
|
||||
: m_serverUrl(serverUrl),
|
||||
m_sessionName(sessionName),
|
||||
m_responseHandler(responseHandler)
|
||||
m_responseHandler(responseHandler),
|
||||
m_dbgDisableCertificateVerification(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -66,6 +64,14 @@ void RicHoloLensRestClient::clearResponseHandler()
|
||||
m_responseHandler = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHoloLensRestClient::dbgDisableCertificateVerification()
|
||||
{
|
||||
m_dbgDisableCertificateVerification = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -84,14 +90,13 @@ void RicHoloLensRestClient::createSession(const QByteArray& sessionPinCode)
|
||||
// NOTE !!!
|
||||
// Apparently something like this is currently needed in order to get SSL/HTTPS going
|
||||
// Still, can't quite figure it out since it appears to be sufficient to do this on the first request
|
||||
// This will have to be investigated further, SP 20181924
|
||||
// This will have to be investigated further, SP 20180924
|
||||
QSslConfiguration sslConf = request.sslConfiguration();
|
||||
|
||||
// Needed this one to be able to connect to sharing server
|
||||
sslConf.setProtocol(QSsl::AnyProtocol);
|
||||
|
||||
bool disableCertificateVerification = RiaApplication::instance()->preferences()->holoLensDisableCertificateVerification();
|
||||
if (disableCertificateVerification)
|
||||
if (m_dbgDisableCertificateVerification)
|
||||
{
|
||||
sslConf.setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ public:
|
||||
|
||||
void clearResponseHandler();
|
||||
|
||||
void dbgDisableCertificateVerification();
|
||||
|
||||
void createSession(const QByteArray& sessionPinCode);
|
||||
void deleteSession();
|
||||
void sendMetaData(int metaDataSequenceNumber, const QString& jsonMetaDataString);
|
||||
@ -82,5 +84,7 @@ private:
|
||||
QString m_sessionName;
|
||||
RicHoloLensRestResponseHandler* m_responseHandler;
|
||||
|
||||
bool m_dbgDisableCertificateVerification; // Debug option to disable certificate verification. Needed in order to work with self-signed certifiactes
|
||||
|
||||
QByteArray m_bearerToken;
|
||||
};
|
||||
|
@ -47,8 +47,7 @@
|
||||
RicHoloLensSession::RicHoloLensSession()
|
||||
: m_isSessionValid(false),
|
||||
m_lastExtractionMetaDataSequenceNumber(-1),
|
||||
m_sessionObserver(nullptr),
|
||||
m_dbgEnableFileExport(false)
|
||||
m_sessionObserver(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -68,13 +67,23 @@ RicHoloLensSession* RicHoloLensSession::createSession(const QString& serverUrl,
|
||||
RicHoloLensSession* newSession = new RicHoloLensSession;
|
||||
|
||||
newSession->m_restClient = new RicHoloLensRestClient(serverUrl, sessionName, newSession);
|
||||
|
||||
if (RiaApplication::instance()->preferences()->holoLensDisableCertificateVerification())
|
||||
{
|
||||
RiaLogging::warning("HoloLens: Disabling certificate verification for HTTPS connections");
|
||||
newSession->m_restClient->dbgDisableCertificateVerification();
|
||||
}
|
||||
|
||||
newSession->m_restClient->createSession(sessionPinCode);
|
||||
|
||||
newSession->m_sessionObserver = sessionObserver;
|
||||
|
||||
// For now, leave this on!!!
|
||||
// We probably want to export this as a preference parameter
|
||||
newSession->m_dbgEnableFileExport = true;
|
||||
const QString dbgExportFolder = RiaApplication::instance()->preferences()->holoLensExportFolder();
|
||||
if (!dbgExportFolder.isEmpty())
|
||||
{
|
||||
newSession->m_dbgFileExportDestinationFolder = dbgExportFolder;
|
||||
RiaLogging::info(QString("HoloLens: Debug file export will be written to folder: %1").arg(dbgExportFolder));
|
||||
}
|
||||
|
||||
return newSession;
|
||||
}
|
||||
@ -88,7 +97,7 @@ RicHoloLensSession* RicHoloLensSession::createDummyFileBackedSession()
|
||||
|
||||
newSession->m_isSessionValid = true;
|
||||
|
||||
newSession->m_dbgEnableFileExport = true;
|
||||
newSession->m_dbgFileExportDestinationFolder = RiaApplication::instance()->preferences()->holoLensExportFolder();
|
||||
|
||||
return newSession;
|
||||
}
|
||||
@ -161,16 +170,9 @@ void RicHoloLensSession::updateSessionDataFromView(const RimGridView& activeView
|
||||
|
||||
|
||||
// Debug export to file
|
||||
if (m_dbgEnableFileExport)
|
||||
if (!m_dbgFileExportDestinationFolder.isEmpty())
|
||||
{
|
||||
const QString folderName = RiaApplication::instance()->preferences()->holoLensExportFolder();
|
||||
if (folderName.isEmpty())
|
||||
{
|
||||
RiaLogging::warning("HoloLens: Debug export to file enabled, but no export folder has been set");
|
||||
return;
|
||||
}
|
||||
|
||||
const QDir outputDir(folderName);
|
||||
const QDir outputDir(m_dbgFileExportDestinationFolder);
|
||||
const QString absOutputFolder = outputDir.absolutePath();
|
||||
|
||||
if (!outputDir.mkpath("."))
|
||||
|
@ -73,5 +73,5 @@ private:
|
||||
|
||||
RicHoloLensSessionObserver* m_sessionObserver;
|
||||
|
||||
bool m_dbgEnableFileExport;
|
||||
QString m_dbgFileExportDestinationFolder;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user