|
|
@@ -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() |