添加logger 验证gateway request header设置用户是否成功
This commit is contained in:
@@ -9,6 +9,8 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -54,6 +56,7 @@ public class UISettingsController {
|
|||||||
@RequestParam(required=false) String envCode,
|
@RequestParam(required=false) String envCode,
|
||||||
@RequestParam(required=false) String groupCode)
|
@RequestParam(required=false) String groupCode)
|
||||||
{
|
{
|
||||||
|
String uid = iUserService.getCurrentUserId();
|
||||||
List<Uisettings> uisettingsList = new ArrayList<Uisettings>();
|
List<Uisettings> uisettingsList = new ArrayList<Uisettings>();
|
||||||
if (envCode!=null && envCode!="") {
|
if (envCode!=null && envCode!="") {
|
||||||
//envCode条件
|
//envCode条件
|
||||||
|
|||||||
@@ -6,18 +6,22 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import sun.misc.BASE64Decoder;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.gzzn.omms.adminapi.dto.HeaderUserDto;
|
import com.gzzn.omms.adminapi.dto.HeaderUserDto;
|
||||||
import com.gzzn.omms.adminapi.exception.UserNoLoginException;
|
import com.gzzn.omms.adminapi.exception.UserNoLoginException;
|
||||||
import com.gzzn.omms.adminapi.service.IUserService;
|
import com.gzzn.omms.adminapi.service.IUserService;
|
||||||
|
|
||||||
import sun.misc.BASE64Decoder;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class UserServiceImpl implements IUserService {
|
public class UserServiceImpl implements IUserService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
private HttpServletRequest request;
|
private HttpServletRequest request;
|
||||||
|
|
||||||
@@ -37,6 +41,7 @@ public class UserServiceImpl implements IUserService {
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
String userStr = request.getHeader("user");
|
String userStr = request.getHeader("user");
|
||||||
|
logger.info("gateway-User:"+userStr);
|
||||||
if(null == userStr)
|
if(null == userStr)
|
||||||
{
|
{
|
||||||
throw new UserNoLoginException();
|
throw new UserNoLoginException();
|
||||||
|
|||||||
Reference in New Issue
Block a user