更新网关

cbx
chenbingxuan 2024-01-16 14:32:40 +08:00
parent e00d68ef89
commit 0a15f6acdd
4 changed files with 16 additions and 19 deletions

View File

@ -11,7 +11,7 @@ public class TokenConstants
* *
*/ */
public static final String AUTHENTICATION = "Authorization"; public static final String AUTHENTICATION = "Authorization";
public static final String SESSIONID = "SESSIONID"; public static final String SESSIONID = "Sessionid";
/** /**
* *

View File

@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilterChain; import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter; import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.http.HttpHeaders;
import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
@ -122,13 +123,9 @@ public class AuthFilter implements GlobalFilter, Ordered
private String getToken(ServerHttpRequest request) private String getToken(ServerHttpRequest request)
{ {
String token = request.getHeaders().getFirst(TokenConstants.AUTHENTICATION); String token = request.getHeaders().getFirst(TokenConstants.AUTHENTICATION);
if (StringUtils.isNotEmpty(token)) if (StringUtils.isEmpty(token))
{ {
token = request.getQueryParams().getFirst(TokenConstants.SESSIONID); token = request.getHeaders().getFirst(TokenConstants.SESSIONID);
}
if(StringUtils.isNotEmpty(token)){
//TODO 解决报错问题
request.getHeaders().set(TokenConstants.SESSIONID,token);
} }
// 如果前端设置了令牌前缀,则裁剪掉前缀 // 如果前端设置了令牌前缀,则裁剪掉前缀
if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX)) if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX))

View File

@ -19,6 +19,7 @@ import doctor.util.OssUtil;
import doctor.util.RSAUtils; import doctor.util.RSAUtils;
import doctor.util.RsaKey; import doctor.util.RsaKey;
import doctor.util.SendEmail; import doctor.util.SendEmail;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;

View File

@ -20,7 +20,7 @@ import doctor.system.service.ISysDictTypeService;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
@ -43,7 +43,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dictType * @param dictType
* @return * @return
*/ */
@ -55,7 +55,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @return * @return
*/ */
@Override @Override
@ -66,7 +66,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dictType * @param dictType
* @return * @return
*/ */
@ -89,7 +89,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* ID * ID
* *
* @param dictId ID * @param dictId ID
* @return * @return
*/ */
@ -101,7 +101,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dictType * @param dictType
* @return * @return
*/ */
@ -113,7 +113,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dictIds ID * @param dictIds ID
*/ */
@Override @Override
@ -167,7 +167,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dict * @param dict
* @return * @return
*/ */
@ -184,7 +184,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dict * @param dict
* @return * @return
*/ */
@ -205,13 +205,12 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dict * @param dict
* @return * @return
*/ */
@Override @Override
public boolean checkDictTypeUnique(SysDictType dict) public boolean checkDictTypeUnique(SysDictType dict) {
{
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType()); SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue())