Commit b93a94c8 authored by tianyiming's avatar tianyiming

机器人账号自动登陆调整为平台功能

parent c39e03f8
......@@ -51,6 +51,21 @@
<artifactId>geodesy</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-authtoken</artifactId>
<version>1.7.13-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>io.springfox</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
......@@ -121,7 +121,7 @@ public class CarController extends AbstractBaseController {
private RestTemplate restTemplate;
@Value("${security.productApp}")
private String productApp;
@Value("${security.appKeyApp}")
@Value("${amos.system.user.app-key}")
private String appKeyApp;
@Value("${iot.vehicle.track}")
private String iotServerName;
......
......@@ -9,6 +9,7 @@ import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.component.authtoken.robot.AmosRequestContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
......@@ -46,18 +47,15 @@ import com.yeejoin.equipmanage.common.vo.Token;
@Service("remoteSecurityService")
public class RemoteSecurityService {
@Value("${security.password}")
@Autowired
AmosRequestContext amosRequestContext;
@Value("${amos.system.user.password}")
private String password;
@Value("${security.loginId}")
private String loginId;
@Value("${security.productWeb}")
private String productWeb;
@Value("${security.productApp}")
private String productApp;
@Value("${security.appKeyApp}")
@Value("${amos.system.user.app-key}")
private String appKeyApp;
@Autowired
......@@ -410,15 +408,15 @@ public class RemoteSecurityService {
public Token getServerToken() {
IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(loginId);
dPasswordAuthModel.setLoginId(amosRequestContext.getUserName());
dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
Token toke = null;
try {
toke = JSON.parseObject(this.redisTemplate.opsForValue().get(buildKey(loginId)), Token.class);
toke = JSON.parseObject(this.redisTemplate.opsForValue().get(buildKey(amosRequestContext.getUserName())), Token.class);
if (ObjectUtils.isEmpty(toke)) {
toke = getLogin(dPasswordAuthModel);
} else {
RequestContext.setProduct(productWeb);
RequestContext.setProduct(amosRequestContext.getProduct());
if (!redisUtils.refresh(toke.getToke())) {
toke = getLogin(dPasswordAuthModel);
}
......@@ -436,15 +434,11 @@ public class RemoteSecurityService {
private Token getLogin(IdPasswordAuthModel dPasswordAuthModel) {
Token toke = new Token();
RequestContext.setProduct(productWeb);
FeignClientResult feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel);
Map map = (Map) feignClientResult.getResult();
if (map != null) {
toke.setToke(map.get("token").toString());
toke.setProduct(productWeb);
toke.setAppKey(appKeyApp);
RequestContext.setProduct(amosRequestContext.getProduct());
toke.setToke(amosRequestContext.getToken());
toke.setProduct(amosRequestContext.getProduct());
toke.setAppKey(amosRequestContext.getAppKey());
redisTemplate.opsForValue().set(buildKey(dPasswordAuthModel.getLoginId()), JSONObject.toJSONString(toke), 28, TimeUnit.DAYS);
}
return toke;
}
}
......@@ -23,12 +23,17 @@ eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#security config
security.password=a1234560
security.loginId=fas_system
#security.password=a1234560
#security.loginId=fas_system
security.productApp=STUDIO_APP_MOBILE
security.productWeb=STUDIO_APP_WEB
security.appKeyApp=studio_normalapp_3056965
#security.productWeb=STUDIO_APP_WEB
#security.appKeyApp=studio_normalapp_3056965
amos.system.user.user-name=fas_system
amos.system.user.password=a1234560
amos.system.user.app-key=studio_normalapp_3056965
amos.system.user.product=STUDIO_APP_WEB
#redis
......
......@@ -17,11 +17,17 @@ eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#security config
security.password=a1234560
security.loginId=fas_system
#security.password=a1234560
#security.loginId=fas_system
security.productApp=STUDIO_APP_MOBILE
security.productWeb=STUDIO_APP_WEB
security.appKeyApp=studio_normalapp_3056965
#security.productWeb=STUDIO_APP_WEB
#security.appKeyApp=studio_normalapp_3056965
amos.system.user.user-name=fas_system
amos.system.user.password=a1234560
amos.system.user.app-key=studio_normalapp_3056965
amos.system.user.product=STUDIO_APP_WEB
#redis
spring.redis.database=1
......
......@@ -23,11 +23,17 @@ eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#security config
security.password=a1234560
security.loginId=fas_system
#security.password=a1234560
#security.loginId=fas_system
security.productApp=STUDIO_APP_MOBILE
security.productWeb=STUDIO_APP_WEB
security.appKeyApp=studio_normalapp_3157169
#security.productWeb=STUDIO_APP_WEB
#security.appKeyApp=studio_normalapp_3056965
amos.system.user.user-name=fas_system
amos.system.user.password=a1234560
amos.system.user.app-key=studio_normalapp_3157169
amos.system.user.product=STUDIO_APP_WEB
#redis
spring.redis.database=0
......
......@@ -17,11 +17,17 @@ eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#security config
security.password=a1234560
security.loginId=fas_system
#security.password=a1234560
#security.loginId=fas_system
security.productApp=STUDIO_APP_MOBILE
security.productWeb=STUDIO_APP_WEB
security.appKeyApp=studio_normalapp_3056965
#security.productWeb=STUDIO_APP_WEB
#security.appKeyApp=studio_normalapp_3056965
amos.system.user.user-name=fas_system
amos.system.user.password=a1234560
amos.system.user.app-key=studio_normalapp_3056965
amos.system.user.product=STUDIO_APP_WEB
#redis
spring.redis.database=1
......
......@@ -17,11 +17,17 @@ eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#security config
security.password=a1234560
security.loginId=fas_system
#security.password=a1234560
#security.loginId=fas_system
security.productApp=STUDIO_APP_MOBILE
security.productWeb=STUDIO_APP_WEB
security.appKeyApp=studio_normalapp_3056965
#security.productWeb=STUDIO_APP_WEB
#security.appKeyApp=studio_normalapp_3056965
amos.system.user.user-name=fas_system
amos.system.user.password=a1234560
amos.system.user.app-key=studio_normalapp_3056965
amos.system.user.product=STUDIO_APP_WEB
#redis
spring.redis.database=1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment