Skip to content

Commit

Permalink
[ISSUE #8622] sub pr of 9356 - auth module (#9447)
Browse files Browse the repository at this point in the history
* [ISSUE #8622] sub pr of 9356 - auth module

- Replace system.getProperties and system.getEnv with  NacosClientProperties
- remove address server controller IT

relate #9356

* [ISSUE #8622] rollback about app name

* [ISSUE #8622] remove unused import

* [ISSUE #8622] retry ci
  • Loading branch information
onewe authored Nov 3, 2022
1 parent 2d2b100 commit 645cd4a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 257 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.alibaba.nacos.client.auth.ram.identify;

import com.alibaba.nacos.client.env.NacosClientProperties;
import com.alibaba.nacos.client.utils.LogUtils;
import com.alibaba.nacos.common.utils.StringUtils;
import org.slf4j.Logger;
Expand Down Expand Up @@ -43,7 +44,7 @@ public final class CredentialService implements SpasCredentialLoader {

private CredentialService(String appName) {
if (appName == null) {
String value = System.getProperty(IdentifyConstants.PROJECT_NAME_PROPERTY);
String value = NacosClientProperties.PROTOTYPE.getProperty(IdentifyConstants.PROJECT_NAME_PROPERTY);
if (StringUtils.isNotEmpty(value)) {
appName = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.alibaba.nacos.client.auth.ram.identify;

import com.alibaba.nacos.client.env.NacosClientProperties;
import com.alibaba.nacos.client.utils.LogUtils;
import com.alibaba.nacos.common.executor.ExecutorFactory;
import com.alibaba.nacos.common.executor.NameThreadFactory;
Expand Down Expand Up @@ -113,7 +114,7 @@ private void loadCredential(boolean init) {
}
if (propertyPath == null || propertyPath.isEmpty()) {

String value = System.getProperty("spas.identity");
String value = NacosClientProperties.PROTOTYPE.getProperty("spas.identity");
if (StringUtils.isNotEmpty(value)) {
propertyPath = value;
}
Expand Down Expand Up @@ -157,8 +158,8 @@ private void loadCredential(boolean init) {
String tenantId = null;
if (propertiesIS == null) {
propertyPath = null;
accessKey = System.getenv(IdentifyConstants.ENV_ACCESS_KEY);
secretKey = System.getenv(IdentifyConstants.ENV_SECRET_KEY);
accessKey = NacosClientProperties.PROTOTYPE.getProperty(IdentifyConstants.ENV_ACCESS_KEY);
secretKey = NacosClientProperties.PROTOTYPE.getProperty(IdentifyConstants.ENV_SECRET_KEY);
if (accessKey == null && secretKey == null) {
if (init) {
SPAS_LOGGER.info("{} No credential found", appName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.alibaba.nacos.client.auth.ram.identify;

import com.alibaba.nacos.client.env.NacosClientProperties;
import com.alibaba.nacos.common.utils.StringUtils;

/**
Expand Down Expand Up @@ -56,27 +57,27 @@ private static class Singleton {
}

private StsConfig() {
String ramRoleName = System.getProperty(IdentifyConstants.RAM_ROLE_NAME_PROPERTY);
String ramRoleName = NacosClientProperties.PROTOTYPE.getProperty(IdentifyConstants.RAM_ROLE_NAME_PROPERTY);
if (!StringUtils.isBlank(ramRoleName)) {
setRamRoleName(ramRoleName);
}

String timeToRefreshInMillisecond = System.getProperty(IdentifyConstants.REFRESH_TIME_PROPERTY);
String timeToRefreshInMillisecond = NacosClientProperties.PROTOTYPE.getProperty(IdentifyConstants.REFRESH_TIME_PROPERTY);
if (!StringUtils.isBlank(timeToRefreshInMillisecond)) {
setTimeToRefreshInMillisecond(Integer.parseInt(timeToRefreshInMillisecond));
}

String securityCredentials = System.getProperty(IdentifyConstants.SECURITY_PROPERTY);
String securityCredentials = NacosClientProperties.PROTOTYPE.getProperty(IdentifyConstants.SECURITY_PROPERTY);
if (!StringUtils.isBlank(securityCredentials)) {
setSecurityCredentials(securityCredentials);
}

String securityCredentialsUrl = System.getProperty(IdentifyConstants.SECURITY_URL_PROPERTY);
String securityCredentialsUrl = NacosClientProperties.PROTOTYPE.getProperty(IdentifyConstants.SECURITY_URL_PROPERTY);
if (!StringUtils.isBlank(securityCredentialsUrl)) {
setSecurityCredentialsUrl(securityCredentialsUrl);
}

String cacheSecurityCredentials = System.getProperty(IdentifyConstants.SECURITY_CACHE_PROPERTY);
String cacheSecurityCredentials = NacosClientProperties.PROTOTYPE.getProperty(IdentifyConstants.SECURITY_CACHE_PROPERTY);
if (!StringUtils.isBlank(cacheSecurityCredentials)) {
setCacheSecurityCredentials(Boolean.parseBoolean(cacheSecurityCredentials));
}
Expand Down

0 comments on commit 645cd4a

Please sign in to comment.