mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 18:39:58 +00:00
TUN-5915: New cloudflared command to allow to retrieve the token credentials for a Tunnel
This commit is contained in:
@@ -72,13 +72,18 @@ class NamedTunnelConfig(NamedTunnelBaseConfig):
|
||||
|
||||
return config
|
||||
|
||||
def get_token(self):
|
||||
with open(self.credentials_file) as json_file:
|
||||
creds = json.load(json_file)
|
||||
token_dict = {"a": creds["AccountTag"], "t": creds["TunnelID"], "s": creds["TunnelSecret"]}
|
||||
token_json_str = json.dumps(token_dict)
|
||||
def get_tunnel_id(self):
|
||||
return self.full_config["tunnel"]
|
||||
|
||||
return base64.b64encode(token_json_str.encode('utf-8'))
|
||||
def get_token(self):
|
||||
creds = self.get_credentials_json()
|
||||
token_dict = {"a": creds["AccountTag"], "t": creds["TunnelID"], "s": creds["TunnelSecret"]}
|
||||
token_json_str = json.dumps(token_dict)
|
||||
return base64.b64encode(token_json_str.encode('utf-8'))
|
||||
|
||||
def get_credentials_json(self):
|
||||
with open(self.credentials_file) as json_file:
|
||||
return json.load(json_file)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
Reference in New Issue
Block a user