Browse Source

新增河湖长相关配置

pull/31/head
chenjiandong 1 year ago
parent
commit
7b6239a137
4 changed files with 39 additions and 3 deletions
  1. +4
    -1
      src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java
  2. +1
    -1
      src/main/java/com/tuoheng/gateway/constants/AuthorityConstant.java
  3. +33
    -0
      src/main/java/com/tuoheng/gateway/constants/PermitPathConstant.java
  4. +1
    -1
      src/main/resources/application-dev.yml

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

@@ -1,6 +1,7 @@
package com.tuoheng.gateway.config;

import com.tuoheng.gateway.constants.AuthorityConstant;
import com.tuoheng.gateway.constants.PermitPathConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties;
@@ -63,13 +64,15 @@ public class WebSecurityConfig {
@Bean
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity httpSecurity){
String[] OAUTH_PATH = oauthUrlStr.split(",");
String[] PERMIT_PATH = permitUrlStr.split(",");
String[] HhzPermitPath = PermitPathConstant.hhzPermitUrlStr;
httpSecurity
.authorizeExchange()
.pathMatchers(OAUTH_PATH).hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_DSP_MP, AuthorityConstant.SCOPE_TUOHNEG_DSP_WEB)
.pathMatchers(HhzPermitPath).permitAll()
.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("/hhz/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_HHZ_ADMIN)
.pathMatchers("/hhz/api/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_HHZ_MP)
.pathMatchers("/oidc/admin/**").authenticated()
//.pathMatchers(PERMIT_PATH).permitAll()
.anyExchange().permitAll()

+ 1
- 1
src/main/java/com/tuoheng/gateway/constants/AuthorityConstant.java View File

@@ -31,6 +31,6 @@ public class AuthorityConstant {
*/
public static final String SCOPE_TUOHNEG_HHZ_ADMIN = "SCOPE_tuoheng-hhz-admin";

public static final String SCOPE_TUOHNEG_HHZ_MP = "SCOPE_tuoheng-hhz-mp";

}

+ 33
- 0
src/main/java/com/tuoheng/gateway/constants/PermitPathConstant.java View File

@@ -0,0 +1,33 @@
package com.tuoheng.gateway.constants;

/**
* @author chenjiandong
* @description: TODO
* @date 2022/12/1 8:49
*/
public class PermitPathConstant {

public static String hhzPermitUrlStr[] = {
"/hhz/admin/analyse/**",
"/hhz/admin/websocket/**",
"/hhz/admin/login/**",
"/hhz/admin/meeting/updatePeopleStatus/**",
"/hhz/admin/download/workUserExcel/**",
"/hhz/admin/tencentCloudRtc/genUserSig/**",
"/hhz/admin/inspection/track/**",
"/hhz/admin/inspection/uploadFlightUrl/**",
"/hhz/admin/inspection/updateTaskByCode/**",
"/hhz/admin/inspection/status/**",
"/hhz/admin/taskFile/**",
"/hhz/admin/flightdata/**",
"/hhz/admin/tenant/**",
"/hhz/admin/dsp/**",
"/hhz/admin/common/**",
"/hhz/api/tenant/**",
"/hhz/api/dsp/**",
"/hhz/api/meeting/updatePeopleStatus/**",
"/hhz/api/common/**",
"/hhz/api/common/**"
};

}

+ 1
- 1
src/main/resources/application-dev.yml View File

@@ -193,4 +193,4 @@ security:

# 获取 apiUrl 可访问的 roleIdList
tuoheng:
hhz-admin-perUrl: http://192.168.11.22:9055/api/permission/getRoleIdList
hhz-admin-perUrl: http://192.168.11.22:9055/permission/getRoleIdList

Loading…
Cancel
Save