优化代码

This commit is contained in:
smallchill 2018-12-27 23:12:41 +08:00
parent 2874ed92f1
commit abcb3856f9
2 changed files with 3 additions and 2 deletions

View File

@ -18,6 +18,7 @@ package org.springblade.core.boot.feign;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.SecureUtil;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@ -42,7 +43,7 @@ public class BladeFeignRequestHeaderInterceptor implements RequestInterceptor {
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
String value = request.getHeader(name);
if ("Authorization".equals(name)) {
if (SecureUtil.HEADER.equals(name)) {
requestTemplate.header(name, value);
}
}

View File

@ -40,7 +40,7 @@ import java.util.Map;
public class SecureUtil {
public static final String BLADE_USER_REQUEST_ATTR = "_BLADE_USER_REQUEST_ATTR_";
public final static String HEADER = "Authorization";
public final static String HEADER = "blade-auth";
public final static String BEARER = "bearer";
public final static String ACCOUNT = "account";
public final static String USER_ID = "userId";