MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / CmdAuthStatus

Function CmdAuthStatus

src/common/cli.cpp:149–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147// ── Command implementations ─────────────────────────────────────────────
148
149std::string CmdAuthStatus(const std::string& provider) {
150 std::string tokenPath = GetTokenPath(provider);
151 if (tokenPath.empty()) {
152 return JsonError("Cannot determine config directory");
153 }
154
155 auto prov = CreateCloudProvider(provider);
156 if (!prov) {
157 return JsonError("Unknown provider: " + provider);
158 }
159
160 if (!prov->Init(tokenPath)) {
161 return JsonObject({
162 {"authenticated", JsonBool(false)},
163 {"error", JsonString("Failed to initialize provider")}
164 });
165 }
166
167 bool authenticated = prov->IsAuthenticated();
168 prov->Shutdown();
169
170 return JsonObject({
171 {"authenticated", JsonBool(authenticated)},
172 {"token_path", JsonString(tokenPath)}
173 });
174}
175
176std::string CmdListRemoteApps(const std::string& provider, const std::string& accountId) {
177 std::string tokenPath = GetTokenPath(provider);

Callers 1

RunCliFunction · 0.85

Calls 9

GetTokenPathFunction · 0.85
JsonErrorFunction · 0.85
CreateCloudProviderFunction · 0.85
JsonObjectFunction · 0.85
JsonBoolFunction · 0.85
JsonStringFunction · 0.85
InitMethod · 0.45
IsAuthenticatedMethod · 0.45
ShutdownMethod · 0.45

Tested by

no test coverage detected