public class CommonsConfig { | public class CommonsConfig { | ||||
/** | /** | ||||
* 图片域名 | |||||
* 河湖长权限接口地址 | |||||
*/ | */ | ||||
public static String hhzPermissionUrl; | public static String hhzPermissionUrl; | ||||
/** | |||||
* 高速权限接口地址 | |||||
*/ | |||||
public static String freewayPermissionUrl; | |||||
@Value("${tuoheng.hhz-admin-perUrl}") | @Value("${tuoheng.hhz-admin-perUrl}") | ||||
public void setPermissionUrl(String url) { | public void setPermissionUrl(String url) { | ||||
hhzPermissionUrl = url; | hhzPermissionUrl = url; | ||||
} | } | ||||
@Value("${tuoheng.hhz-admin-perUrl}") | |||||
public void setFreewayPermissionUrl(String url) { | |||||
freewayPermissionUrl = url; | |||||
} | |||||
} | } |
} | } | ||||
//header里封装 Client-Id 信息 | //header里封装 Client-Id 信息 | ||||
String clientId = getClientId(exchange); | String clientId = getClientId(exchange); | ||||
log.info("clientId is :{}", clientId); | |||||
if(!StringUtils.isEmpty(clientId)){ | if(!StringUtils.isEmpty(clientId)){ | ||||
log.info("clientId is :{}", clientId); | |||||
String requestUrl = exchange.getRequest().getPath().value(); | String requestUrl = exchange.getRequest().getPath().value(); | ||||
log.info("requestUrl is :{}", requestUrl); | |||||
//去除gateway path 前缀 | //去除gateway path 前缀 | ||||
String apiUrl = requestUrl.replace(GatewayUrlPathUtil.getPathByClientId(clientId),""); | String apiUrl = requestUrl.replace(GatewayUrlPathUtil.getPathByClientId(clientId),""); | ||||
log.info("apiUrl is :{}", apiUrl); | |||||
log.info("requestUrl is :{}; apiUrl is :{}", requestUrl, apiUrl); | |||||
List<Integer> roleIds = GatewayUrlPathUtil.getRoleIdByApiUrlPermission(clientId, apiUrl, token); | List<Integer> roleIds = GatewayUrlPathUtil.getRoleIdByApiUrlPermission(clientId, apiUrl, token); | ||||
log.info("roleIds is :{}", roleIds); | log.info("roleIds is :{}", roleIds); | ||||
//return invalidClientIdMono(exchange); | //return invalidClientIdMono(exchange); |
if(clientId.equals(HHZ_ADMIN) || clientId.equals(HHZ_MP)){ | if(clientId.equals(HHZ_ADMIN) || clientId.equals(HHZ_MP)){ | ||||
url = CommonsConfig.hhzPermissionUrl; | url = CommonsConfig.hhzPermissionUrl; | ||||
} | } | ||||
if(clientId.equals(FREEWAY_ADMIN) || clientId.equals(FREEWAY_MP)){ | |||||
url = CommonsConfig.freewayPermissionUrl; | |||||
} | |||||
log.info("getRoleIdByApiUrlPermission - url:{}", url); | |||||
if(StringUtils.isNotBlank(url)){ | if(StringUtils.isNotBlank(url)){ | ||||
log.info("getRoleIdByApiUrlPermission - url:{}", url); | |||||
HttpHeaders resultRequestHeader = new HttpHeaders(); | HttpHeaders resultRequestHeader = new HttpHeaders(); | ||||
resultRequestHeader.add("Authorization", "Bearer " + token); | resultRequestHeader.add("Authorization", "Bearer " + token); | ||||
JSONObject json = new JSONObject(); | JSONObject json = new JSONObject(); |
# 获取 apiUrl 可访问的 roleIdList | # 获取 apiUrl 可访问的 roleIdList | ||||
tuoheng: | tuoheng: | ||||
hhz-admin-perUrl: http://192.168.11.11:9055/permission/getRoleIdList | |||||
hhz-admin-perUrl: http://192.168.11.11:9055/permission/getRoleIdList | |||||
freeway-admin-perUrl: http://192.168.11.11:9117/permission/getRoleIdList |
# 获取 apiUrl 可访问的 roleIdList | # 获取 apiUrl 可访问的 roleIdList | ||||
tuoheng: | tuoheng: | ||||
hhz-admin-perUrl: http://127.0.0.1:9055/api/permission/getRoleIdList | |||||
hhz-admin-perUrl: http://127.0.0.1:9055/api/permission/getRoleIdList | |||||
freeway-admin-perUrl: |
# 获取 apiUrl 可访问的 roleIdList | # 获取 apiUrl 可访问的 roleIdList | ||||
tuoheng: | tuoheng: | ||||
hhz-admin-perUrl: https://hhz.t-aaron.com/permission/getRoleIdList | hhz-admin-perUrl: https://hhz.t-aaron.com/permission/getRoleIdList | ||||
freeway-admin-perUrl: |
# 获取 apiUrl 可访问的 roleIdList | # 获取 apiUrl 可访问的 roleIdList | ||||
tuoheng: | tuoheng: | ||||
hhz-admin-perUrl: http://172.15.1.21:9055/permission/getRoleIdList | |||||
hhz-admin-perUrl: http://172.15.1.21:9055/permission/getRoleIdList | |||||
freeway-admin-perUrl: |