Bläddra i källkod

修改统一配置

pull/7/head
chenjiandong 2 år sedan
förälder
incheckning
a56c7da116
2 ändrade filer med 10 tillägg och 5 borttagningar
  1. +3
    -3
      src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java
  2. +7
    -2
      src/main/java/com/tuoheng/gateway/constants/AuthorityConstant.java

+ 3
- 3
src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java Visa fil

@@ -67,9 +67,9 @@ public class WebSecurityConfig {
httpSecurity
.authorizeExchange()
.pathMatchers("/api/system/demo/admin").hasAuthority(AuthorityConstant.SCOPE_ADMIN)
.pathMatchers("/api/system/demo/dsp").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_DSP)
.pathMatchers("/api/system/demo/hhz").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_HHZ)
.pathMatchers(OAUTH_PATH).hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_DSP)
.pathMatchers("/api/system/demo/dsp").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_DSP_MP)
.pathMatchers("/api/system/demo/hhz").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_DSP_WEB)
.pathMatchers(OAUTH_PATH).hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_DSP_MP, AuthorityConstant.SCOPE_TUOHNEG_DSP_WEB)
//.pathMatchers("/api/system/**").hasAnyRole("ROLE_ADMIN", "ROLE_DSP")
//.pathMatchers(PERMIT_PATH).permitAll()
.anyExchange().permitAll()

+ 7
- 2
src/main/java/com/tuoheng/gateway/constants/AuthorityConstant.java Visa fil

@@ -8,12 +8,17 @@ public class AuthorityConstant {
/**
* admin 用户权限
*/
public static final String SCOPE_ADMIN = "SCOPE_ADMIN";
public static final String SCOPE_ADMIN = "admin";

/**
* dsp 用户权限
*/
public static final String SCOPE_DSP = "SCOPE_DSP";
public static final String SCOPE_TUOHNEG_DSP_MP = "SCOPE_tuoheng-dsp-mp";

/**
* dsp 用户权限
*/
public static final String SCOPE_TUOHNEG_DSP_WEB = "SCOPE_tuoheng-dsp-web";

/**
* 河湖长用户权限

Laddar…
Avbryt
Spara