HADOOP-16568. S3A FullCredentialsTokenBinding fails if local credentials are unset. (#1441)
Contributed by Steve Loughran. Move the loading to deployUnbonded (where they are required) and add a safety check when a new DT is requested Change-Id: I03c69aa2e16accfccddca756b2771ff832e7dd58
This commit is contained in:
parent
cf84bec6e3
commit
8a642caca8
|
@ -22,6 +22,8 @@ import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.s3a.AWSCredentialProviderList;
|
import org.apache.hadoop.fs.s3a.AWSCredentialProviderList;
|
||||||
import org.apache.hadoop.fs.s3a.S3AUtils;
|
import org.apache.hadoop.fs.s3a.S3AUtils;
|
||||||
|
@ -73,7 +75,6 @@ public class FullCredentialsTokenBinding extends
|
||||||
@Override
|
@Override
|
||||||
protected void serviceStart() throws Exception {
|
protected void serviceStart() throws Exception {
|
||||||
super.serviceStart();
|
super.serviceStart();
|
||||||
loadAWSCredentials();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,6 +117,7 @@ public class FullCredentialsTokenBinding extends
|
||||||
@Override
|
@Override
|
||||||
public AWSCredentialProviderList deployUnbonded() throws IOException {
|
public AWSCredentialProviderList deployUnbonded() throws IOException {
|
||||||
requireServiceStarted();
|
requireServiceStarted();
|
||||||
|
loadAWSCredentials();
|
||||||
return new AWSCredentialProviderList(
|
return new AWSCredentialProviderList(
|
||||||
"Full Credentials Token Binding",
|
"Full Credentials Token Binding",
|
||||||
new MarshalledCredentialProvider(
|
new MarshalledCredentialProvider(
|
||||||
|
@ -142,7 +144,8 @@ public class FullCredentialsTokenBinding extends
|
||||||
final EncryptionSecrets encryptionSecrets,
|
final EncryptionSecrets encryptionSecrets,
|
||||||
final Text renewer) throws IOException {
|
final Text renewer) throws IOException {
|
||||||
requireServiceStarted();
|
requireServiceStarted();
|
||||||
|
Preconditions.checkNotNull(
|
||||||
|
awsCredentials, "No AWS credentials to use for a delegation token");
|
||||||
return new FullCredentialsTokenIdentifier(getCanonicalUri(),
|
return new FullCredentialsTokenIdentifier(getCanonicalUri(),
|
||||||
getOwnerText(),
|
getOwnerText(),
|
||||||
renewer,
|
renewer,
|
||||||
|
|
Loading…
Reference in New Issue