Commit 78c1b9b2 authored by suhuiguang's avatar suhuiguang

Merge branch 'dev_upgrade' of http://172.16.10.76/station/YeeAmosFireAutoSysRoot into dev_upgrade

parents 4f094b72 c920d9c1
package com.yeejoin.amos.fas.business.controller;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.vo.Toke;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* @Author: xinglei
* @Description:
* @Date: 2020/5/27 15:26
*/
@RestController
@RequestMapping("/api/login")
@Api("免密登录api")
public class AvoidLoginController extends BaseController{
@Value("${oauth2.accessToken}")
private String checkAccessToken;
@Value("${oauth2.password}")
private String password;
@Autowired
private RemoteSecurityService remoteSecurityService;
@ApiOperation(httpMethod = "GET",value = "免密登录获取token", notes = "免密登录获取token")
@RequestMapping(value = "/avoid/{loginId}/{accessToken}/{expireTime}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse avoidLogin(@PathVariable String loginId, @PathVariable String accessToken, @PathVariable Integer expireTime) {
if (accessToken.equals(checkAccessToken)){
Toke toke = remoteSecurityService.avoidLogin(loginId, password, expireTime);
return CommonResponseUtil.success(toke);
}
return CommonResponseUtil.failure("令牌不正确");
}
}
......@@ -166,35 +166,6 @@ public class RemoteSecurityService {
return oked;
}
/**
* 免密登录
* @return
*/
public Toke avoidLogin(String loginId, String password, Integer expireTime){
StationAuthModel stationAuthModel=new StationAuthModel();
stationAuthModel.setLoginId(loginId);
stationAuthModel.setPassword(password);
stationAuthModel.setExpireTime(expireTime);
Map map=null;
FeignClientResult feignClientResult;
Toke oked=new Toke();
try {
RequestContext.setProduct(productWeb);
feignClientResult = Privilege.authClient.idpasswordStation(stationAuthModel);
//Privilege.authClient.idpasswordStation();
map = (Map) feignClientResult.getResult();
if(map!=null){
oked.setToke(map.get("token").toString());
oked.setProduct(productWeb);
oked.setAppKey(appKeyWeb);
}
} catch (InnerInvokException e) {
e.printStackTrace();
}
return oked;
}
/* public List<UserModel> listUserByRoleIds(String roleIds) {
CommonResponse commonResponse = iAmosSecurityServer.listUserByRoleIds(roleIds);
return handleArray(commonResponse, UserModel.class);
......
......@@ -2,9 +2,6 @@ security.password=tw123456
security.loginId=tw3
security.productWeb=CONVERTER_STATION_WEB
security.appKeyWeb=CONVERTER_STATION
oauth2.accessToken=my
oauth2.password=a1234560
#environment
#spring.profiles.active = dev
......
......@@ -2,9 +2,6 @@ security.password=tw123456
security.loginId=tw3
security.productWeb=CONVERTER_STATION_WEB
security.appKeyWeb=CONVERTER_STATION
oauth2.accessToken=my
oauth2.password=a123456
#environment
#spring.profiles.active = dev
......
......@@ -2,9 +2,6 @@ security.password=tw123456
security.loginId=tw3
security.productWeb=CONVERTER_STATION_WEB
security.appKeyWeb=CONVERTER_STATION
oauth2.accessToken=my
oauth2.password=a123456
#environment
#spring.profiles.active = dev
......
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