|
8 | 8 | import click |
9 | 9 | import configparser |
10 | 10 | import json |
11 | | -from .config import ConfigManager |
12 | 11 | import os |
13 | 12 | from .encryption import StringEncryption, InvalidPassphraseException |
14 | 13 |
|
@@ -42,11 +41,11 @@ def b64_encode_url_safe(value: bytes): |
42 | 41 |
|
43 | 42 | # this base class expects self.credentials to be a dict - so sub classes need to convert to dict |
44 | 43 | class CredentialManager: |
45 | | - def __init__(self, tenant_name: str, tenant_alias: str, cli: ConfigManager): |
| 44 | + def __init__(self, tenant_name: str, tenant_alias: str, cli): |
46 | 45 | self.cli = cli |
47 | 46 | self.tenant = tenant_name |
48 | 47 | self.alias = tenant_alias |
49 | | - self.base_url = f'https://{self.tenant}.britive-app.com' |
| 48 | + self.base_url = f'https://{cli.parse_tenant()}' |
50 | 49 |
|
51 | 50 | # not sure if we really need 32 random bytes or if any random string would work |
52 | 51 | # but the current britive-cli in node.js does it this way so it will be done the same |
@@ -138,7 +137,7 @@ def has_valid_credentials(self): |
138 | 137 |
|
139 | 138 |
|
140 | 139 | class FileCredentialManager(CredentialManager): |
141 | | - def __init__(self, tenant_name: str, tenant_alias: str, cli: ConfigManager): |
| 140 | + def __init__(self, tenant_name: str, tenant_alias: str, cli): |
142 | 141 | home = os.getenv('PYBRITIVE_HOME_DIR', str(Path.home())) |
143 | 142 | self.path = str(Path(home) / '.britive' / 'pybritive.credentials') |
144 | 143 | super().__init__(tenant_name, tenant_alias, cli) |
@@ -179,7 +178,7 @@ def delete(self): |
179 | 178 |
|
180 | 179 |
|
181 | 180 | class EncryptedFileCredentialManager(CredentialManager): |
182 | | - def __init__(self, tenant_name: str, tenant_alias: str, cli: ConfigManager, passphrase: str = None): |
| 181 | + def __init__(self, tenant_name: str, tenant_alias: str, cli, passphrase: str = None): |
183 | 182 | home = os.getenv('PYBRITIVE_HOME_DIR', str(Path.home())) |
184 | 183 | self.path = str(Path(home) / '.britive' / 'pybritive.credentials.encrypted') |
185 | 184 | self.passphrase = passphrase |
|
0 commit comments