Pārlūkot izejas kodu

Merge branch 'release' of gitadmin/tuoheng_gateway into master

gitadmin-patch-1
gitadmin pirms 2 gadiem
vecāks
revīzija
e570f66bb1
2 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. +3
    -0
      src/main/java/com/tuoheng/gateway/config/GatewayFilterConfig.java
  2. +1
    -1
      src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java

+ 3
- 0
src/main/java/com/tuoheng/gateway/config/GatewayFilterConfig.java Parādīt failu

@@ -51,6 +51,7 @@ public class GatewayFilterConfig implements GlobalFilter, Ordered {
List<Integer> roleIds = permissionMap.get(requestUrl);*/
//todo:获取当前系统、当前接口 可以访问的角色集合 end
String token = getToken(exchange);
System.out.println("登录人token:" + token);
String username = null;
Long oUserId = null;
List<String> authorityList = new ArrayList<>();
@@ -59,7 +60,9 @@ public class GatewayFilterConfig implements GlobalFilter, Ordered {
//token数据解析
DecodedJWT decodedJWT = JWT.decode(token);
username = decodedJWT.getClaim(USERNAME).asString();
System.out.println("登录人username:" + username);
oUserId = decodedJWT.getClaim(OUSERID).asLong();
System.out.println("登录人oUserId:" + oUserId);
authorityList = decodedJWT.getClaim(SCOPE).asList(String.class);
clientUserRoleDtoList = decodedJWT.getClaim(CLIENTROLELIST).asList(ClientUserRoleDto.class);
}

+ 1
- 1
src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java Parādīt failu

@@ -69,7 +69,7 @@ public class WebSecurityConfig {
.pathMatchers(OAUTH_PATH).hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_DSP_MP, AuthorityConstant.SCOPE_TUOHNEG_DSP_WEB)
.pathMatchers("/pilot/miniprogram/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_PILOT_MP)
.pathMatchers("/pilot/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_PILOT_ADMIN)
//.pathMatchers("/oidc/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_OIDC_ADMIN)
.pathMatchers("/oidc/admin/**").authenticated()
//.pathMatchers(PERMIT_PATH).permitAll()
.anyExchange().permitAll()
.and()

Notiek ielāde…
Atcelt
Saglabāt