|
@@ -63,6 +63,9 @@ import org.apache.hadoop.security.ssl.DelegatingSSLSocketFactory;
|
|
|
import org.apache.hadoop.security.ProviderUtils;
|
|
|
import org.apache.hadoop.util.ReflectionUtils;
|
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+
|
|
|
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.*;
|
|
|
import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.*;
|
|
|
|
|
@@ -76,6 +79,7 @@ public class AbfsConfiguration{
|
|
|
private final Configuration rawConfig;
|
|
|
private final String accountName;
|
|
|
private final boolean isSecure;
|
|
|
+ private static final Logger LOG = LoggerFactory.getLogger(AbfsConfiguration.class);
|
|
|
|
|
|
@IntegerConfigurationValidatorAnnotation(ConfigurationKey = AZURE_WRITE_BUFFER_SIZE,
|
|
|
MinValue = MIN_BUFFER_SIZE,
|
|
@@ -505,11 +509,13 @@ public class AbfsConfiguration{
|
|
|
String clientId = getPasswordString(FS_AZURE_ACCOUNT_OAUTH_CLIENT_ID);
|
|
|
String clientSecret = getPasswordString(FS_AZURE_ACCOUNT_OAUTH_CLIENT_SECRET);
|
|
|
tokenProvider = new ClientCredsTokenProvider(authEndpoint, clientId, clientSecret);
|
|
|
+ LOG.trace("ClientCredsTokenProvider initialized");
|
|
|
} else if (tokenProviderClass == UserPasswordTokenProvider.class) {
|
|
|
String authEndpoint = getPasswordString(FS_AZURE_ACCOUNT_OAUTH_CLIENT_ENDPOINT);
|
|
|
String username = getPasswordString(FS_AZURE_ACCOUNT_OAUTH_USER_NAME);
|
|
|
String password = getPasswordString(FS_AZURE_ACCOUNT_OAUTH_USER_PASSWORD);
|
|
|
tokenProvider = new UserPasswordTokenProvider(authEndpoint, username, password);
|
|
|
+ LOG.trace("UserPasswordTokenProvider initialized");
|
|
|
} else if (tokenProviderClass == MsiTokenProvider.class) {
|
|
|
String authEndpoint = getTrimmedPasswordString(
|
|
|
FS_AZURE_ACCOUNT_OAUTH_MSI_ENDPOINT,
|
|
@@ -522,6 +528,7 @@ public class AbfsConfiguration{
|
|
|
authority = appendSlashIfNeeded(authority);
|
|
|
tokenProvider = new MsiTokenProvider(authEndpoint, tenantGuid,
|
|
|
clientId, authority);
|
|
|
+ LOG.trace("MsiTokenProvider initialized");
|
|
|
} else if (tokenProviderClass == RefreshTokenBasedTokenProvider.class) {
|
|
|
String authEndpoint = getTrimmedPasswordString(
|
|
|
FS_AZURE_ACCOUNT_OAUTH_REFRESH_TOKEN_ENDPOINT,
|
|
@@ -530,6 +537,7 @@ public class AbfsConfiguration{
|
|
|
String clientId = getPasswordString(FS_AZURE_ACCOUNT_OAUTH_CLIENT_ID);
|
|
|
tokenProvider = new RefreshTokenBasedTokenProvider(authEndpoint,
|
|
|
clientId, refreshToken);
|
|
|
+ LOG.trace("RefreshTokenBasedTokenProvider initialized");
|
|
|
} else {
|
|
|
throw new IllegalArgumentException("Failed to initialize " + tokenProviderClass);
|
|
|
}
|
|
@@ -554,7 +562,9 @@ public class AbfsConfiguration{
|
|
|
if (azureTokenProvider == null) {
|
|
|
throw new IllegalArgumentException("Failed to initialize " + customTokenProviderClass);
|
|
|
}
|
|
|
+ LOG.trace("Initializing {}", customTokenProviderClass.getName());
|
|
|
azureTokenProvider.initialize(rawConfig, accountName);
|
|
|
+ LOG.trace("{} init complete", customTokenProviderClass.getName());
|
|
|
return new CustomTokenProviderAdapter(azureTokenProvider);
|
|
|
} catch(IllegalArgumentException e) {
|
|
|
throw e;
|
|
@@ -581,7 +591,9 @@ public class AbfsConfiguration{
|
|
|
@SuppressWarnings("unchecked")
|
|
|
Class<AbfsAuthorizer> authClass = (Class<AbfsAuthorizer>) rawConfig.getClassByName(authClassName);
|
|
|
authorizer = authClass.getConstructor(new Class[] {Configuration.class}).newInstance(rawConfig);
|
|
|
+ LOG.trace("Initializing {}", authClassName);
|
|
|
authorizer.init();
|
|
|
+ LOG.trace("{} init complete", authClassName);
|
|
|
}
|
|
|
} catch (
|
|
|
IllegalAccessException
|