我有一个在EKS中运行的应用程序实例,设置了以下变量:
declare -x AWS_DEFAULT_REGION="us-west-2"
declare -x AWS_REGION="us-west-2"
declare -x AWS_ROLE_ARN="xxxxx"
declare -x AWS_WEB_IDENTITY_TOKEN_FILE="/var/run/secrets/eks.amazonaws.com/serviceaccount/token"据我所知,有一个默认的Java SDK授权链,其中包含在幕后构建com.amazonaws.services.securitytoken.AWSSecurityTokenService的com.amazonaws.auth.WebIdentityTokenCredentialsProvider。
但是我不知道这种循环依赖是如何解决的?我的意思是,您需要在创建AWSSecurityTokenService时指定凭据,但凭据会创建服务本身。
我有这样做的实际需求,我想在sts客户端中自定义端点,但因为循环依赖而不能。
AWSSecurityTokenServiceClientBuilder.standard()
.withCredentials(new STSAssumeRoleWithWebIdentitySessionCredentialsProvider.Builder(
"arn",
"session",
"tokenfile")
.withStsClient(xxxx)
.build())
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://localhost:4566", null))
.build()发布于 2021-05-14 20:49:48
这很简单。它只是使用匿名身份验证(https://github.com/aws/aws-sdk-java/blob/1.11.792/aws-java-sdk-sts/src/main/java/com/amazonaws/auth/STSAssumeRoleWithWebIdentitySessionCredentialsProvider.java#L122-L125)完成的
return AWSSecurityTokenServiceClientBuilder.standard()
.withClientConfiguration(clientConfiguration)
.withCredentials(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()))
.build();https://stackoverflow.com/questions/67534009
复制相似问题