aliyun / credentials-java

Alibaba Cloud Credentials for Java
Apache License 2.0
10 stars 4 forks source link

Obtain STS via X-aliyun-ecs-metadata-token is not work #57

Closed jht5945 closed 1 month ago

jht5945 commented 8 months ago

The SDK only works with direct fetch STS token:

curl http://100.100.100.200/latest/meta-data/ram/security-credentials/<Name of the instance RAM role>

More secure method via X-aliyun-ecs-metadata-token is not work:

# Obtain the access credentials of the metadata server for authentication.
TOKEN=`curl -X PUT "http://100.100.100.200/latest/api/token" -H "X-aliyun-ecs-metadata-token-ttl-seconds:<Validity period of the metadata server access credentials>"` 
# Obtain a temporary authorization token for the instance RAM role.
curl -H "X-aliyun-ecs-metadata-token: $TOKEN" http://100.100.100.200/latest/meta-data/ram/security-credentials/<Name of the instance RAM role>

Reference: https://www.alibabacloud.com/help/en/ecs/user-guide/obtain-a-temporary-authorization-token

yndu13 commented 1 month ago

已支持