aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-10-06 10:30:44 +0200
committerGitHub Enterprise <[email protected]>2025-10-06 10:30:44 +0200
commit0d8e54e660560264df4a9b096867cb9b68d99a00 (patch)
tree5f90099d4447c0a007b01b156dd69d04d74170d1 /src
parentspeed up tests (#555) (diff)
downloadzen-0d8e54e660560264df4a9b096867cb9b68d99a00.tar.xz
zen-0d8e54e660560264df4a9b096867cb9b68d99a00.zip
added Hidden option to oidctoken creation with oidc token exe (#556)
Diffstat (limited to 'src')
-rw-r--r--src/zen/authutils.cpp5
-rw-r--r--src/zen/authutils.h3
-rw-r--r--src/zen/cmds/builds_cmd.cpp9
-rw-r--r--src/zen/cmds/projectstore_cmd.cpp8
-rw-r--r--src/zenhttp/httpclientauth.cpp15
-rw-r--r--src/zenhttp/include/zenhttp/httpclientauth.h3
-rw-r--r--src/zenremotestore/include/zenremotestore/projectstore/buildsremoteprojectstore.h3
-rw-r--r--src/zenremotestore/include/zenremotestore/projectstore/jupiterremoteprojectstore.h3
-rw-r--r--src/zenremotestore/projectstore/buildsremoteprojectstore.cpp5
-rw-r--r--src/zenremotestore/projectstore/jupiterremoteprojectstore.cpp8
-rw-r--r--src/zenserver/projectstore/httpprojectstore.cpp4
11 files changed, 47 insertions, 19 deletions
diff --git a/src/zen/authutils.cpp b/src/zen/authutils.cpp
index 69ea3f9c2..bc185535b 100644
--- a/src/zen/authutils.cpp
+++ b/src/zen/authutils.cpp
@@ -146,7 +146,8 @@ AuthCommandLineOptions::ParseOptions(cxxopts::Options& Ops,
HttpClientSettings& ClientSettings,
std::string_view HostUrl,
std::unique_ptr<AuthMgr>& Auth,
- bool Quiet)
+ bool Quiet,
+ bool Hidden)
{
auto CreateAuthMgr = [&]() {
ZEN_ASSERT(!SystemRootDir.empty());
@@ -234,7 +235,7 @@ AuthCommandLineOptions::ParseOptions(cxxopts::Options& Ops,
else if (std::filesystem::path OidcTokenExePath = FindOidcTokenExePath(m_OidcTokenAuthExecutablePath); !OidcTokenExePath.empty())
{
ClientSettings.AccessTokenProvider =
- httpclientauth::CreateFromOidcTokenExecutable(OidcTokenExePath, HostUrl, Quiet, m_OidcTokenUnattended);
+ httpclientauth::CreateFromOidcTokenExecutable(OidcTokenExePath, HostUrl, Quiet, m_OidcTokenUnattended, Hidden);
}
if (!ClientSettings.AccessTokenProvider)
diff --git a/src/zen/authutils.h b/src/zen/authutils.h
index 3cc9d4d4a..8f041c8fc 100644
--- a/src/zen/authutils.h
+++ b/src/zen/authutils.h
@@ -41,7 +41,8 @@ struct AuthCommandLineOptions
HttpClientSettings& InOutClientSettings,
std::string_view HostUrl,
std::unique_ptr<AuthMgr>& OutAuthMgr,
- bool Quiet);
+ bool Quiet,
+ bool Hidden);
};
std::string ReadAccessTokenFromJsonFile(const std::filesystem::path& Path);
diff --git a/src/zen/cmds/builds_cmd.cpp b/src/zen/cmds/builds_cmd.cpp
index de1ca5031..7f53a7f02 100644
--- a/src/zen/cmds/builds_cmd.cpp
+++ b/src/zen/cmds/builds_cmd.cpp
@@ -10837,8 +10837,13 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (!m_Host.empty() || !m_OverrideHost.empty())
{
- m_AuthOptions
- .ParseOptions(*SubOption, m_SystemRootDir, ClientSettings, m_OverrideHost.empty() ? m_Host : m_OverrideHost, Auth, IsQuiet);
+ m_AuthOptions.ParseOptions(*SubOption,
+ m_SystemRootDir,
+ ClientSettings,
+ m_OverrideHost.empty() ? m_Host : m_OverrideHost,
+ Auth,
+ IsQuiet,
+ /*Hidden*/ false);
}
std::string CloudHost;
diff --git a/src/zen/cmds/projectstore_cmd.cpp b/src/zen/cmds/projectstore_cmd.cpp
index ad75b239b..4a3cb15ca 100644
--- a/src/zen/cmds/projectstore_cmd.cpp
+++ b/src/zen/cmds/projectstore_cmd.cpp
@@ -2309,7 +2309,13 @@ OplogDownloadCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** a
ParseStorageOptions(/*RequireNamespace*/ true, /*RequireBucket*/ true);
- m_AuthOptions.ParseOptions(m_Options, m_SystemRootDir, ClientSettings, m_OverrideHost.empty() ? m_Host : m_OverrideHost, Auth, m_Quiet);
+ m_AuthOptions.ParseOptions(m_Options,
+ m_SystemRootDir,
+ ClientSettings,
+ m_OverrideHost.empty() ? m_Host : m_OverrideHost,
+ Auth,
+ m_Quiet,
+ /*Hidden*/ false);
std::string BuildStorageName = ZEN_CLOUD_STORAGE;
diff --git a/src/zenhttp/httpclientauth.cpp b/src/zenhttp/httpclientauth.cpp
index 4438fc137..8754c57d6 100644
--- a/src/zenhttp/httpclientauth.cpp
+++ b/src/zenhttp/httpclientauth.cpp
@@ -94,7 +94,8 @@ namespace zen { namespace httpclientauth {
static HttpClientAccessToken GetOidcTokenFromExe(const std::filesystem::path& OidcExecutablePath,
std::string_view CloudHost,
bool Unattended,
- bool Quiet)
+ bool Quiet,
+ bool Hidden)
{
Stopwatch Timer;
@@ -103,6 +104,10 @@ namespace zen { namespace httpclientauth {
{
ProcOptions.StdoutFile = std::filesystem::temp_directory_path() / fmt::format(".zen-auth-output-{}", Oid::NewOid());
}
+ if (Hidden)
+ {
+ ProcOptions.Flags |= CreateProcOptions::Flag_NoConsole;
+ }
const std::filesystem::path AuthTokenPath(std::filesystem::temp_directory_path() / fmt::format(".zen-auth-{}", Oid::NewOid()));
auto _ = MakeGuard([AuthTokenPath, &ProcOptions]() {
@@ -181,14 +186,16 @@ namespace zen { namespace httpclientauth {
std::optional<std::function<HttpClientAccessToken()>> CreateFromOidcTokenExecutable(const std::filesystem::path& OidcExecutablePath,
std::string_view CloudHost,
bool Quiet,
- bool Unattended)
+ bool Unattended,
+ bool Hidden)
{
- HttpClientAccessToken InitialToken = GetOidcTokenFromExe(OidcExecutablePath, CloudHost, Unattended, Quiet);
+ HttpClientAccessToken InitialToken = GetOidcTokenFromExe(OidcExecutablePath, CloudHost, Unattended, Quiet, Hidden);
if (InitialToken.IsValid())
{
return [OidcExecutablePath = std::filesystem::path(OidcExecutablePath),
CloudHost = std::string(CloudHost),
Quiet,
+ Hidden,
InitialToken]() mutable {
if (InitialToken.IsValid())
{
@@ -196,7 +203,7 @@ namespace zen { namespace httpclientauth {
InitialToken = {};
return Result;
}
- return GetOidcTokenFromExe(OidcExecutablePath, CloudHost, /* Unattended */ true, Quiet);
+ return GetOidcTokenFromExe(OidcExecutablePath, CloudHost, /* Unattended */ true, Quiet, Hidden);
};
}
return {};
diff --git a/src/zenhttp/include/zenhttp/httpclientauth.h b/src/zenhttp/include/zenhttp/httpclientauth.h
index f44cb9b0d..26f31ed2a 100644
--- a/src/zenhttp/include/zenhttp/httpclientauth.h
+++ b/src/zenhttp/include/zenhttp/httpclientauth.h
@@ -29,7 +29,8 @@ namespace httpclientauth {
std::optional<std::function<HttpClientAccessToken()>> CreateFromOidcTokenExecutable(const std::filesystem::path& OidcExecutablePath,
std::string_view CloudHost,
bool Quiet,
- bool Unattended);
+ bool Unattended,
+ bool Hidden);
} // namespace httpclientauth
} // namespace zen
diff --git a/src/zenremotestore/include/zenremotestore/projectstore/buildsremoteprojectstore.h b/src/zenremotestore/include/zenremotestore/projectstore/buildsremoteprojectstore.h
index fc59e41f4..037325ed1 100644
--- a/src/zenremotestore/include/zenremotestore/projectstore/buildsremoteprojectstore.h
+++ b/src/zenremotestore/include/zenremotestore/projectstore/buildsremoteprojectstore.h
@@ -27,6 +27,7 @@ struct BuildsRemoteStoreOptions : RemoteStoreOptions
std::shared_ptr<RemoteProjectStore> CreateJupiterBuildsRemoteStore(const BuildsRemoteStoreOptions& Options,
const std::filesystem::path& TempFilePath,
bool Quiet,
- bool Unattended);
+ bool Unattended,
+ bool Hidden);
} // namespace zen
diff --git a/src/zenremotestore/include/zenremotestore/projectstore/jupiterremoteprojectstore.h b/src/zenremotestore/include/zenremotestore/projectstore/jupiterremoteprojectstore.h
index d800005a9..13a346039 100644
--- a/src/zenremotestore/include/zenremotestore/projectstore/jupiterremoteprojectstore.h
+++ b/src/zenremotestore/include/zenremotestore/projectstore/jupiterremoteprojectstore.h
@@ -27,6 +27,7 @@ struct JupiterRemoteStoreOptions : RemoteStoreOptions
std::shared_ptr<RemoteProjectStore> CreateJupiterRemoteStore(const JupiterRemoteStoreOptions& Options,
const std::filesystem::path& TempFilePath,
bool Quiet,
- bool Unattended);
+ bool Unattended,
+ bool Hidden);
} // namespace zen
diff --git a/src/zenremotestore/projectstore/buildsremoteprojectstore.cpp b/src/zenremotestore/projectstore/buildsremoteprojectstore.cpp
index cb01ac955..2cc8ed4aa 100644
--- a/src/zenremotestore/projectstore/buildsremoteprojectstore.cpp
+++ b/src/zenremotestore/projectstore/buildsremoteprojectstore.cpp
@@ -477,7 +477,8 @@ std::shared_ptr<RemoteProjectStore>
CreateJupiterBuildsRemoteStore(const BuildsRemoteStoreOptions& Options,
const std::filesystem::path& TempFilePath,
bool Quiet,
- bool Unattended)
+ bool Unattended,
+ bool Hidden)
{
std::string Url = Options.Url;
if (Url.find("://"sv) == std::string::npos)
@@ -502,7 +503,7 @@ CreateJupiterBuildsRemoteStore(const BuildsRemoteStoreOptions& Options,
}
else if (!Options.OidcExePath.empty())
{
- if (auto TokenProviderMaybe = httpclientauth::CreateFromOidcTokenExecutable(Options.OidcExePath, Url, Quiet, Unattended);
+ if (auto TokenProviderMaybe = httpclientauth::CreateFromOidcTokenExecutable(Options.OidcExePath, Url, Quiet, Unattended, Hidden);
TokenProviderMaybe)
{
TokenProvider = TokenProviderMaybe.value();
diff --git a/src/zenremotestore/projectstore/jupiterremoteprojectstore.cpp b/src/zenremotestore/projectstore/jupiterremoteprojectstore.cpp
index b198b7c99..dda5ef99d 100644
--- a/src/zenremotestore/projectstore/jupiterremoteprojectstore.cpp
+++ b/src/zenremotestore/projectstore/jupiterremoteprojectstore.cpp
@@ -343,7 +343,11 @@ private:
};
std::shared_ptr<RemoteProjectStore>
-CreateJupiterRemoteStore(const JupiterRemoteStoreOptions& Options, const std::filesystem::path& TempFilePath, bool Quiet, bool Unattended)
+CreateJupiterRemoteStore(const JupiterRemoteStoreOptions& Options,
+ const std::filesystem::path& TempFilePath,
+ bool Quiet,
+ bool Unattended,
+ bool Hidden)
{
std::string Url = Options.Url;
if (Url.find("://"sv) == std::string::npos)
@@ -374,7 +378,7 @@ CreateJupiterRemoteStore(const JupiterRemoteStoreOptions& Options, const std::fi
}
else if (!Options.OidcExePath.empty())
{
- if (auto TokenProviderMaybe = httpclientauth::CreateFromOidcTokenExecutable(Options.OidcExePath, Url, Quiet, Unattended);
+ if (auto TokenProviderMaybe = httpclientauth::CreateFromOidcTokenExecutable(Options.OidcExePath, Url, Quiet, Unattended, Hidden);
TokenProviderMaybe)
{
TokenProvider = TokenProviderMaybe.value();
diff --git a/src/zenserver/projectstore/httpprojectstore.cpp b/src/zenserver/projectstore/httpprojectstore.cpp
index 8f2dbd830..1c6b5d6b0 100644
--- a/src/zenserver/projectstore/httpprojectstore.cpp
+++ b/src/zenserver/projectstore/httpprojectstore.cpp
@@ -372,7 +372,7 @@ namespace {
ForceDisableBlocks,
ForceDisableTempBlocks,
AssumeHttp2};
- RemoteStore = CreateJupiterRemoteStore(Options, TempFilePath, /*Quiet*/ false, /*Unattended*/ false);
+ RemoteStore = CreateJupiterRemoteStore(Options, TempFilePath, /*Quiet*/ false, /*Unattended*/ false, /*Hidden*/ true);
}
if (CbObjectView Zen = Params["zen"sv].AsObjectView(); Zen)
@@ -474,7 +474,7 @@ namespace {
ForceDisableTempBlocks,
AssumeHttp2,
MetaData};
- RemoteStore = CreateJupiterBuildsRemoteStore(Options, TempFilePath, /*Quiet*/ false, /*Unattended*/ false);
+ RemoteStore = CreateJupiterBuildsRemoteStore(Options, TempFilePath, /*Quiet*/ false, /*Unattended*/ false, /*Hidden*/ true);
}
if (!RemoteStore)