[abfs] Do not require credentials in client when Raz is on
@@ -30,16 +30,26 @@ LOG = logging.getLogger(__name__)
def _make_adls_client(identifier, user):
+ auth_provider = get_credential_provider(identifier, user)
client_conf = conf.ADLS_CLUSTERS[identifier]
- return WebHdfs.from_config(client_conf, get_credential_provider(identifier, user))
+
+ return WebHdfs.from_config(client_conf, auth_provider)
def _make_abfs_client(identifier, user):
+ auth_provider = get_credential_provider(identifier, user, version='v2.0')
client_conf = conf.ABFS_CLUSTERS[identifier]
- return ABFS.from_config(client_conf, get_credential_provider(identifier, user, version='v2.0'))
+
+ return ABFS.from_config(client_conf, auth_provider)
def get_credential_provider(identifier, user, version=None):
+ from desktop.conf import RAZ
+ if RAZ.IS_ENABLED.get():
+ return RazCredentialProvider()
+ else:
client_conf = conf.AZURE_ACCOUNTS[identifier] if identifier in conf.AZURE_ACCOUNTS else None
- return CredentialProviderIDBroker(IDBroker.from_core_site('azure', user)) if conf_idbroker.is_idbroker_enabled('azure') else CredentialProviderAD(ActiveDirectory.from_config(client_conf, version=version))
+ return CredentialProviderIDBroker(IDBroker.from_core_site('azure', user)) if conf_idbroker.is_idbroker_enabled('azure') \
+ else CredentialProviderAD(ActiveDirectory.from_config(client_conf, version=version))
+
class CredentialProviderAD(object):
def __init__(self, ad):
@@ -54,3 +64,8 @@ class CredentialProviderIDBroker(object):
def get_credentials(self):
return self.idbroker.get_cab()
+
+class RazCredentialProvider(object):
+ def get_credentials(self):
+ # No credentials are required
+ return {}
