This commit is contained in:
wangkang
2017-08-07 14:48:46 +08:00
parent 8ffa53b0ca
commit 4971a53a47
2 changed files with 10 additions and 11 deletions
@@ -54,6 +54,8 @@ public class RmsAuthHandlerInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, //NOSONAR
Object handler) {
//获得当前环境
String profilesActive = env.getProperty("spring.profiles.active");
//获取认证信息(应用名称)
String rmsApplicationName = request.getHeader(Constant.HEADER_RMS_APPLICATION_NAME_CODE);
if (StringUtils.isBlank(rmsApplicationName)) {
@@ -74,10 +76,9 @@ public class RmsAuthHandlerInterceptor implements HandlerInterceptor {
//获取请求方法
String method = request.getMethod();
//日志
LOGGER.info("rmsApplicationName:{},rmsSign:{},rmsServiceCode:{},url:{},method:{}", rmsApplicationName, rmsSign,
rmsServiceCode, url, method);
LOGGER.info("profiles.active:{},rmsApplicationName:{},rmsSign:{},rmsServiceCode:{},url:{},method:{}", profilesActive, rmsApplicationName, rmsSign, rmsServiceCode, url, method);
//判断环境(开发环境无需校验)
if (!DEV_PROFILES.equals(env.getProperty("spring.profiles.active"))) {
if (!DEV_PROFILES.equals(profilesActive)) {
//判断是否缺少认证信息
if (StringUtils.isBlank(rmsApplicationName) || StringUtils.isBlank(rmsSign)) {
throw new AuthException("missing required authentication parameters (rmsApplicationName , rmsSign)");
@@ -6,18 +6,16 @@
*/
package org.itkk.udf.rms.web;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.itkk.udf.core.RestResponse;
import org.itkk.udf.rms.RmsConfig;
import org.itkk.udf.rms.RmsProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.itkk.udf.core.RestResponse;
import org.itkk.udf.rms.RmsConfig;
import org.itkk.udf.rms.RmsProperties;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 描述 : RmsController
*
@@ -25,7 +23,7 @@ import io.swagger.annotations.ApiOperation;
*/
@Api(value = "rest服务", consumes = "application/json", produces = "application/json", protocols = "http")
@RestController
@RequestMapping("rms")
@RequestMapping("service/rms")
public class RmsController {
/**