aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-09-20 09:43:09 +0200
committerPer Larsson <[email protected]>2021-09-20 09:43:09 +0200
commite156e761e0f0e02ea3e557b67b7fa8c24cf1cc4c (patch)
treebf3d101cfc989cffa87398faef08f5a7be492c20
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
downloadzen-e156e761e0f0e02ea3e557b67b7fa8c24cf1cc4c.tar.xz
zen-e156e761e0f0e02ea3e557b67b7fa8c24cf1cc4c.zip
Try authenticate with Jupiter instance when initializing upstream cache.
-rw-r--r--zenserver/upstream/jupiter.cpp8
-rw-r--r--zenserver/upstream/jupiter.h1
-rw-r--r--zenserver/upstream/upstreamcache.cpp5
3 files changed, 12 insertions, 2 deletions
diff --git a/zenserver/upstream/jupiter.cpp b/zenserver/upstream/jupiter.cpp
index fbd945528..2e74602db 100644
--- a/zenserver/upstream/jupiter.cpp
+++ b/zenserver/upstream/jupiter.cpp
@@ -66,6 +66,14 @@ CloudCacheSession::~CloudCacheSession()
}
CloudCacheResult
+CloudCacheSession::Authenticate()
+{
+ std::string Auth;
+ const bool Success = m_CacheClient->AcquireAccessToken(Auth);
+ return {.Success = Success};
+}
+
+CloudCacheResult
CloudCacheSession::GetDerivedData(std::string_view BucketId, std::string_view Key)
{
std::string Auth;
diff --git a/zenserver/upstream/jupiter.h b/zenserver/upstream/jupiter.h
index 5535ba000..21217387c 100644
--- a/zenserver/upstream/jupiter.h
+++ b/zenserver/upstream/jupiter.h
@@ -61,6 +61,7 @@ public:
CloudCacheSession(CloudCacheClient* OuterClient);
~CloudCacheSession();
+ CloudCacheResult Authenticate();
CloudCacheResult GetDerivedData(std::string_view BucketId, std::string_view Key);
CloudCacheResult GetDerivedData(std::string_view BucketId, const IoHash& Key);
CloudCacheResult GetRef(std::string_view BucketId, const IoHash& Key, ZenContentType RefType);
diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp
index e235db516..ecd540445 100644
--- a/zenserver/upstream/upstreamcache.cpp
+++ b/zenserver/upstream/upstreamcache.cpp
@@ -108,8 +108,9 @@ namespace detail {
virtual bool Initialize() override
{
- // TODO: Test and authenticate Jupiter client connection
- return !m_Client->ServiceUrl().empty();
+ zen::CloudCacheSession Session(m_Client);
+ const CloudCacheResult Result = Session.Authenticate();
+ return Result.Success;
}
virtual std::string_view DisplayName() const override { return m_DisplayName; }