1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "zen.h"
namespace zen {
struct HttpClientSettings;
class AuthMgr;
struct AuthCommandLineOptions
{
// Direct access token (may expire)
std::string m_AccessToken;
std::string m_AccessTokenEnv;
std::filesystem::path m_AccessTokenPath;
// Auth manager token encryption
std::string m_EncryptionKey; // 256 bit AES encryption key
std::string m_EncryptionIV; // 128 bit AES initialization vector
// OpenId acccess token
std::string m_OpenIdProviderName;
std::string m_OpenIdProviderUrl;
std::string m_OpenIdClientId;
std::string m_OpenIdRefreshToken;
// OAuth acccess token
std::string m_OAuthUrl;
std::string m_OAuthClientId;
std::string m_OAuthClientSecret;
std::string m_OidcTokenAuthExecutablePath;
bool m_OidcTokenUnattended = false;
void AddOptions(cxxopts::Options& Ops);
void ParseOptions(cxxopts::Options& Ops,
const std::filesystem::path& SystemRootDir,
HttpClientSettings& InOutClientSettings,
std::string_view HostUrl,
std::unique_ptr<AuthMgr>& OutAuthMgr,
bool Quiet,
bool Hidden,
bool Verbose);
private:
void CreateAuthMgr(cxxopts::Options& Ops,
const std::filesystem::path& SystemRootDir,
std::unique_ptr<AuthMgr>& InOutAuth,
bool Quiet,
bool Verbose);
void LoadOrCreateMachineKey(const std::filesystem::path& AuthDir, bool Quiet);
};
std::string ReadAccessTokenFromJsonFile(const std::filesystem::path& Path);
std::string_view GetDefaultAccessTokenEnvVariableName();
} // namespace zen
|