添加logger 验证gateway request header设置用户是否成功

This commit is contained in:
fanghongchao
2018-11-14 18:08:56 +08:00
parent b0eea6942d
commit 1e9c85f5e3
2 changed files with 10 additions and 2 deletions
@@ -9,6 +9,8 @@ import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
@@ -54,6 +56,7 @@ public class UISettingsController {
@RequestParam(required=false) String envCode,
@RequestParam(required=false) String groupCode)
{
String uid = iUserService.getCurrentUserId();
List<Uisettings> uisettingsList = new ArrayList<Uisettings>();
if (envCode!=null && envCode!="") {
//envCode条件
@@ -6,18 +6,22 @@ import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sun.misc.BASE64Decoder;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gzzn.omms.adminapi.dto.HeaderUserDto;
import com.gzzn.omms.adminapi.exception.UserNoLoginException;
import com.gzzn.omms.adminapi.service.IUserService;
import sun.misc.BASE64Decoder;
@Service
public class UserServiceImpl implements IUserService {
private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);
@Autowired
private HttpServletRequest request;
@@ -37,6 +41,7 @@ public class UserServiceImpl implements IUserService {
try
{
String userStr = request.getHeader("user");
logger.info("gateway-User:"+userStr);
if(null == userStr)
{
throw new UserNoLoginException();