aboutsummaryrefslogtreecommitdiff
path: root/zenserver/auth
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2022-01-28 13:03:44 +0100
committerPer Larsson <[email protected]>2022-01-28 13:03:44 +0100
commitc775f3f39bc2a3d8c018c3a925a7cd61231ef3a9 (patch)
tree152399c6b8aa05e51107801431c65a938e0a788f /zenserver/auth
parentExtended auth mgr to restore OpenID provider(s) and token(s). (diff)
downloadzen-c775f3f39bc2a3d8c018c3a925a7cd61231ef3a9.tar.xz
zen-c775f3f39bc2a3d8c018c3a925a7cd61231ef3a9.zip
Get access token from auth mgr.
Diffstat (limited to 'zenserver/auth')
-rw-r--r--zenserver/auth/authmgr.cpp14
-rw-r--r--zenserver/auth/authmgr.h8
2 files changed, 22 insertions, 0 deletions
diff --git a/zenserver/auth/authmgr.cpp b/zenserver/auth/authmgr.cpp
index 20bc7c988..28e128fc0 100644
--- a/zenserver/auth/authmgr.cpp
+++ b/zenserver/auth/authmgr.cpp
@@ -116,6 +116,20 @@ public:
return true;
}
+ virtual OpenIdAccessToken GetOpenIdAccessToken(std::string_view ProviderName) final
+ {
+ std::unique_lock _(m_TokenMutex);
+
+ if (auto It = m_OpenIdTokens.find(std::string(ProviderName)); It != m_OpenIdTokens.end())
+ {
+ const OpenIdToken& Token = It->second;
+
+ return {.AccessToken = Token.AccessToken};
+ }
+
+ return {};
+ }
+
private:
bool OpenIdProviderExist(std::string_view ProviderName)
{
diff --git a/zenserver/auth/authmgr.h b/zenserver/auth/authmgr.h
index 16d4071bf..1138d9eff 100644
--- a/zenserver/auth/authmgr.h
+++ b/zenserver/auth/authmgr.h
@@ -29,7 +29,15 @@ public:
std::string_view AccessToken;
};
+
virtual bool AddOpenIdToken(const AddOpenIdTokenParams& Params) = 0;
+
+ struct OpenIdAccessToken
+ {
+ std::string AccessToken;
+ };
+
+ virtual OpenIdAccessToken GetOpenIdAccessToken(std::string_view ProviderName) = 0;
};
struct AuthConfig