support aliyun ram role
This commit is contained in:
parent
06df9ab738
commit
d11fd7f73e
@ -32,6 +32,8 @@ public class PropertyKeyConst {
|
|||||||
|
|
||||||
public final static String SECRET_KEY = "secretKey";
|
public final static String SECRET_KEY = "secretKey";
|
||||||
|
|
||||||
|
public final static String RAM_ROLE_NAME = "ramRoleName";
|
||||||
|
|
||||||
public final static String SERVER_ADDR = "serverAddr";
|
public final static String SERVER_ADDR = "serverAddr";
|
||||||
|
|
||||||
public final static String CONTEXT_PATH = "contextPath";
|
public final static String CONTEXT_PATH = "contextPath";
|
||||||
|
@ -222,6 +222,11 @@ public class ServerHttpAgent implements HttpAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initAkSk(Properties properties) {
|
private void initAkSk(Properties properties) {
|
||||||
|
String ramRoleName = properties.getProperty(PropertyKeyConst.RAM_ROLE_NAME);
|
||||||
|
if (!StringUtils.isBlank(ramRoleName)) {
|
||||||
|
STSConfig.getInstance().setRamRoleName(ramRoleName);
|
||||||
|
}
|
||||||
|
|
||||||
String ak = properties.getProperty(PropertyKeyConst.ACCESS_KEY);
|
String ak = properties.getProperty(PropertyKeyConst.ACCESS_KEY);
|
||||||
if (StringUtils.isBlank(ak)) {
|
if (StringUtils.isBlank(ak)) {
|
||||||
accessKey = SpasAdapter.getAk();
|
accessKey = SpasAdapter.getAk();
|
||||||
|
@ -25,7 +25,7 @@ import com.alibaba.nacos.client.utils.StringUtils;
|
|||||||
@SuppressWarnings("PMD.ClassNamingShouldBeCamelRule")
|
@SuppressWarnings("PMD.ClassNamingShouldBeCamelRule")
|
||||||
public class STSConfig {
|
public class STSConfig {
|
||||||
private static final String RAM_SECURITY_CREDENTIALS_URL
|
private static final String RAM_SECURITY_CREDENTIALS_URL
|
||||||
= "";
|
= "http://100.100.100.200/latest/meta-data/ram/security-credentials/";
|
||||||
private String ramRoleName;
|
private String ramRoleName;
|
||||||
/**
|
/**
|
||||||
* STS 临时凭证有效期剩余多少时开始刷新(允许本地时间比 STS 服务时间最多慢多久)
|
* STS 临时凭证有效期剩余多少时开始刷新(允许本地时间比 STS 服务时间最多慢多久)
|
||||||
|
Loading…
Reference in New Issue
Block a user