Browse Source

Merge branch 'develop' of gitadmin/tuoheng_gateway into release

pull/25/head
gitadmin 2 years ago
parent
commit
5ebff286c5
2 changed files with 4 additions and 1 deletions
  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 View File

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

+ 1
- 1
src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java View File

.pathMatchers(OAUTH_PATH).hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_DSP_MP, AuthorityConstant.SCOPE_TUOHNEG_DSP_WEB) .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/miniprogram/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_PILOT_MP)
.pathMatchers("/pilot/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_PILOT_ADMIN) .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() //.pathMatchers(PERMIT_PATH).permitAll()
.anyExchange().permitAll() .anyExchange().permitAll()
.and() .and()

Loading…
Cancel
Save