mirror of
https://github.com/chillzhuang/blade-tool
synced 2024-12-12 12:19:27 +08:00
⚡ 优化代码
This commit is contained in:
parent
2874ed92f1
commit
abcb3856f9
@ -18,6 +18,7 @@ package org.springblade.core.boot.feign;
|
|||||||
import feign.RequestInterceptor;
|
import feign.RequestInterceptor;
|
||||||
import feign.RequestTemplate;
|
import feign.RequestTemplate;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ public class BladeFeignRequestHeaderInterceptor implements RequestInterceptor {
|
|||||||
while (headerNames.hasMoreElements()) {
|
while (headerNames.hasMoreElements()) {
|
||||||
String name = headerNames.nextElement();
|
String name = headerNames.nextElement();
|
||||||
String value = request.getHeader(name);
|
String value = request.getHeader(name);
|
||||||
if ("Authorization".equals(name)) {
|
if (SecureUtil.HEADER.equals(name)) {
|
||||||
requestTemplate.header(name, value);
|
requestTemplate.header(name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ import java.util.Map;
|
|||||||
public class SecureUtil {
|
public class SecureUtil {
|
||||||
public static final String BLADE_USER_REQUEST_ATTR = "_BLADE_USER_REQUEST_ATTR_";
|
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 BEARER = "bearer";
|
||||||
public final static String ACCOUNT = "account";
|
public final static String ACCOUNT = "account";
|
||||||
public final static String USER_ID = "userId";
|
public final static String USER_ID = "userId";
|
||||||
|
Loading…
Reference in New Issue
Block a user