Commit 621eb5a0 authored by Jørgen Lind's avatar Jørgen Lind
Browse files

Merge branch feature/paal_kvamme/dms_auth_callback with refs/heads/master into...

Merge branch feature/paal_kvamme/dms_auth_callback with refs/heads/master into refs/merge-requests/529/train
parents 0bb93545 c3b130c8
Pipeline #85363 passed with stages
in 22 minutes and 46 seconds
...@@ -321,3 +321,6 @@ PyGlobal::initModule(py::module& m) ...@@ -321,3 +321,6 @@ PyGlobal::initModule(py::module& m)
// IMPLEMENTED : m.def_property_readonly("openVDSVersion", &GetOpenVDSVersion, OPENVDS_DOCSTRING(GetOpenVDSVersion)); // IMPLEMENTED : m.def_property_readonly("openVDSVersion", &GetOpenVDSVersion, OPENVDS_DOCSTRING(GetOpenVDSVersion));
// IMPLEMENTED : m.def_property_readonly("openVDSRevision", &GetOpenVDSRevision, OPENVDS_DOCSTRING(GetOpenVDSRevision)); // IMPLEMENTED : m.def_property_readonly("openVDSRevision", &GetOpenVDSRevision, OPENVDS_DOCSTRING(GetOpenVDSRevision));
// IMPLEMENTED : DMSOpenOptions_.def(py::init<const std::string &, const std::string &, const std::string &, std::string (*)(const void *), const void *, int, bool>(), py::arg("sdAuthorityUrl").none(false), py::arg("sdApiKey").none(false), py::arg("datasetPath").none(false), py::arg("authProviderCallback").none(false), py::arg("authProviderCallbackData").none(false), py::arg("logLevel") = 0, py::arg("useFileNameForSingleFileDatasets") = false, OPENVDS_DOCSTRING(DMSOpenOptions_DMSOpenOptions_3));
// IMPLEMENTED : DMSOpenOptions_.def_readwrite("authProviderCallback" , &DMSOpenOptions::authProviderCallback, OPENVDS_DOCSTRING(DMSOpenOptions_authProviderCallback));
// IMPLEMENTED : DMSOpenOptions_.def_readwrite("authProviderCallbackData" , &DMSOpenOptions::authProviderCallbackData, OPENVDS_DOCSTRING(DMSOpenOptions_authProviderCallbackData));
...@@ -211,7 +211,11 @@ namespace OpenVDS ...@@ -211,7 +211,11 @@ namespace OpenVDS
try { try {
m_sdManager.reset(new seismicdrive::SDManager(openOptions.sdAuthorityUrl, openOptions.sdApiKey, openOptions.logLevel)); m_sdManager.reset(new seismicdrive::SDManager(openOptions.sdAuthorityUrl, openOptions.sdApiKey, openOptions.logLevel));
if (openOptions.authTokenUrl.size() && openOptions.clientId.size() && openOptions.refreshToken.size()) if (openOptions.authProviderCallback)
{
m_sdManager->setAuthProviderCallback(openOptions.authProviderCallback, openOptions.authProviderCallbackData);
}
else if (openOptions.authTokenUrl.size() && openOptions.clientId.size() && openOptions.refreshToken.size())
{ {
m_curlHandler.reset(new CurlHandler(error)); m_curlHandler.reset(new CurlHandler(error));
if (error.code != 0) if (error.code != 0)
......
...@@ -457,7 +457,7 @@ struct GoogleOpenOptions : OpenOptions ...@@ -457,7 +457,7 @@ struct GoogleOpenOptions : OpenOptions
struct DMSOpenOptions : OpenOptions struct DMSOpenOptions : OpenOptions
{ {
DMSOpenOptions() : OpenOptions(DMS), logLevel(0), useFileNameForSingleFileDatasets(false) {} DMSOpenOptions() : OpenOptions(DMS), logLevel(0), useFileNameForSingleFileDatasets(false) , authProviderCallback(nullptr) , authProviderCallbackData(nullptr) {}
DMSOpenOptions(std::string const& sdAuthorityUrl, std::string const& sdApiKey, std::string const &sdToken, std::string const &datasetPath, int logLevel, std::string const &authTokenUrl = std::string(), std::string const &refreshToken = std::string(), std::string const &clientId = std::string(), std::string const &clientSecret = std::string(), std::string const &scopes = std::string(), bool useFileNameForSingleFileDatasets = false) DMSOpenOptions(std::string const& sdAuthorityUrl, std::string const& sdApiKey, std::string const &sdToken, std::string const &datasetPath, int logLevel, std::string const &authTokenUrl = std::string(), std::string const &refreshToken = std::string(), std::string const &clientId = std::string(), std::string const &clientSecret = std::string(), std::string const &scopes = std::string(), bool useFileNameForSingleFileDatasets = false)
: OpenOptions(DMS) : OpenOptions(DMS)
...@@ -472,6 +472,19 @@ struct DMSOpenOptions : OpenOptions ...@@ -472,6 +472,19 @@ struct DMSOpenOptions : OpenOptions
, clientSecret(clientSecret) , clientSecret(clientSecret)
, scopes(scopes) , scopes(scopes)
, useFileNameForSingleFileDatasets(useFileNameForSingleFileDatasets) , useFileNameForSingleFileDatasets(useFileNameForSingleFileDatasets)
, authProviderCallback(nullptr)
, authProviderCallbackData(nullptr)
{}
DMSOpenOptions(std::string const& sdAuthorityUrl, std::string const& sdApiKey, std::string const &datasetPath, std::string (*authProviderCallback)(const void*), const void *authProviderCallbackData, int logLevel = 0, bool useFileNameForSingleFileDatasets = false)
: OpenOptions(DMS)
, sdAuthorityUrl(sdAuthorityUrl)
, sdApiKey(sdApiKey)
, datasetPath(datasetPath)
, logLevel(logLevel)
, useFileNameForSingleFileDatasets(useFileNameForSingleFileDatasets)
, authProviderCallback(authProviderCallback)
, authProviderCallbackData(authProviderCallbackData)
{} {}
std::string sdAuthorityUrl; std::string sdAuthorityUrl;
...@@ -485,6 +498,8 @@ struct DMSOpenOptions : OpenOptions ...@@ -485,6 +498,8 @@ struct DMSOpenOptions : OpenOptions
std::string clientSecret; std::string clientSecret;
std::string scopes; std::string scopes;
bool useFileNameForSingleFileDatasets; bool useFileNameForSingleFileDatasets;
std::string (*authProviderCallback)(const void*);
const void *authProviderCallbackData;
}; };
/// <summary> /// <summary>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment