summaryrefslogtreecommitdiff
path: root/src/buildtool/common/cli.hpp
diff options
context:
space:
mode:
authorAlberto Sartori <alberto.sartori@huawei.com>2023-01-05 16:35:33 +0100
committerAlberto Sartori <alberto.sartori@huawei.com>2023-01-18 15:52:03 +0100
commit4ae1447b3d821bfb77bedcf67422369ae59c74dd (patch)
tree2cfeafce95db3134fea5a9be67657c0f987f699f /src/buildtool/common/cli.hpp
parent24e7398e225fc288d0a299fc6cd77fcf1539835c (diff)
downloadjustbuild-4ae1447b3d821bfb77bedcf67422369ae59c74dd.tar.gz
authentication: add TLS and mTLS support
Diffstat (limited to 'src/buildtool/common/cli.hpp')
-rw-r--r--src/buildtool/common/cli.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp
index 4650f749..b9c2feb9 100644
--- a/src/buildtool/common/cli.hpp
+++ b/src/buildtool/common/cli.hpp
@@ -125,6 +125,14 @@ struct GraphArguments {
std::optional<std::filesystem::path> git_cas{};
};
+/// \brief Arguments for authentication methods.
+struct AuthArguments {
+ // CA certificate used to verify server's identity
+ std::optional<std::filesystem::path> tls_ca_cert{std::nullopt};
+ std::optional<std::filesystem::path> tls_client_cert{std::nullopt};
+ std::optional<std::filesystem::path> tls_client_key{std::nullopt};
+};
+
static inline auto SetupCommonArguments(
gsl::not_null<CLI::App*> const& app,
gsl::not_null<CommonArguments*> const& clargs) {
@@ -457,4 +465,19 @@ static inline auto SetupCompatibilityArguments(
"remote build execution protocol. As the change affects identifiers, "
"the flag must be used consistently for all related invocations.");
}
+
+static inline auto SetupAuthArguments(
+ gsl::not_null<CLI::App*> const& app,
+ gsl::not_null<AuthArguments*> const& authargs) {
+ app->add_option("--tls-ca-cert",
+ authargs->tls_ca_cert,
+ "Path to a TLS CA certificate that is trusted to sign the "
+ "server certificate.");
+ app->add_option("--tls-client-cert",
+ authargs->tls_client_cert,
+ "Path to the TLS client certificate.");
+ app->add_option("--tls-client-key",
+ authargs->tls_client_key,
+ "Path to the TLS client key.");
+}
#endif // INCLUDED_SRC_BUILDTOOL_COMMON_CLI_HPP