mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
新增网关和服务灰度能力
This commit is contained in:
@@ -59,4 +59,9 @@ public class LoginUser {
|
||||
* 部门编号
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 灰度版本号
|
||||
*/
|
||||
private String grayVersion;
|
||||
}
|
||||
|
||||
+1
-1
@@ -150,7 +150,7 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered {
|
||||
.setOrganId(tokenInfo.getOrganId()).setScopes(tokenInfo.getScopes())
|
||||
.setLarge(tokenInfo.getLarge()).setDbNo(tokenInfo.getDbNo()).setTableNo(tokenInfo.getTableNo())
|
||||
.setDataCode(tokenInfo.getDataCode()).setIsSupAdmin(tokenInfo.getIsSupAdmin())
|
||||
.setNickname(tokenInfo.getNickname()).setDeptId(tokenInfo.getDeptId());
|
||||
.setNickname(tokenInfo.getNickname()).setDeptId(tokenInfo.getDeptId()).setGrayVersion(tokenInfo.getGrayVersion());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,8 @@ public class SecurityFrameworkUtils {
|
||||
|
||||
private static final String LOGIN_USER_HEADER = "login-user";
|
||||
|
||||
private static final String LOGIN_USER_GRAY_VERSION = "version";
|
||||
|
||||
private static final String LOGIN_USER_ID_ATTR = "login-user-id";
|
||||
private static final String LOGIN_USER_TYPE_ATTR = "login-user-type";
|
||||
private static final String DATA_CODE = "data-code";
|
||||
@@ -122,6 +124,11 @@ public class SecurityFrameworkUtils {
|
||||
}
|
||||
builder.header(DATA_CODE, user.getDataCode());
|
||||
builder.header(ORGAN_ID, user.getOrganId().toString());
|
||||
// 灰度版本号设置到headers,继续往下filter选择实例
|
||||
String grayVersion = user.getGrayVersion();
|
||||
if (StringUtils.hasText(grayVersion)) {
|
||||
builder.header(LOGIN_USER_GRAY_VERSION, grayVersion);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setOrganHeader(ServerHttpRequest.Builder builder, LoginUser user) {
|
||||
|
||||
Reference in New Issue
Block a user