|
@@ -22,8 +22,8 @@ import cn.seecoder.web.infrastructure.security.WebSecurityConstants;
|
|
|
* @date 2021/3/5
|
|
* @date 2021/3/5
|
|
|
* @description:
|
|
* @description:
|
|
|
*/
|
|
*/
|
|
|
-@Configuration
|
|
|
|
|
-@EnableWebSecurity
|
|
|
|
|
|
|
+ @Configuration
|
|
|
|
|
+ @EnableWebSecurity
|
|
|
@EnableGlobalMethodSecurity(prePostEnabled = true) // 启用方法级别的权限认证
|
|
@EnableGlobalMethodSecurity(prePostEnabled = true) // 启用方法级别的权限认证
|
|
|
//@DependsOn("userServiceImpl")
|
|
//@DependsOn("userServiceImpl")
|
|
|
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
@@ -44,16 +44,20 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
//访问控制
|
|
//访问控制
|
|
|
http
|
|
http
|
|
|
//访问swagger
|
|
//访问swagger
|
|
|
- .anonymous()
|
|
|
|
|
- .authorities("ROLE_ANONYMOUS").and()
|
|
|
|
|
- .authorizeRequests()
|
|
|
|
|
- .antMatchers("/**/*swagger*/**").permitAll()
|
|
|
|
|
- .antMatchers("/**/*api-docs*/**").permitAll()
|
|
|
|
|
- .antMatchers("/**/hook").permitAll()
|
|
|
|
|
- .antMatchers("/**/query/**").permitAll()
|
|
|
|
|
-
|
|
|
|
|
- .and()
|
|
|
|
|
|
|
+// .anonymous()
|
|
|
|
|
+// .authorities("ROLE_ANONYMOUS").and()
|
|
|
.authorizeRequests()
|
|
.authorizeRequests()
|
|
|
|
|
+// .antMatchers("/**/*swagger*/**").permitAll()
|
|
|
|
|
+// .antMatchers("/**/*api-docs*/**").permitAll()
|
|
|
|
|
+// .antMatchers("/**/hook").permitAll()
|
|
|
|
|
+// .antMatchers("/**/query/**").permitAll()
|
|
|
|
|
+ .antMatchers("/**/*swagger*/**").anonymous()
|
|
|
|
|
+ .antMatchers("/**/*api-docs*/**").anonymous()
|
|
|
|
|
+ .antMatchers("/**/hook").anonymous()
|
|
|
|
|
+ .antMatchers("/**/query/**").anonymous()
|
|
|
|
|
+//
|
|
|
|
|
+// .and()
|
|
|
|
|
+// .authorizeRequests()
|
|
|
// API Test Controller
|
|
// API Test Controller
|
|
|
.antMatchers(HttpMethod.GET, "/api/test/list/{projectId}").access("@authTools.checkProjOwnership(#projectId)")
|
|
.antMatchers(HttpMethod.GET, "/api/test/list/{projectId}").access("@authTools.checkProjOwnership(#projectId)")
|
|
|
.antMatchers(HttpMethod.GET, "/api/test/delete/{testId}").access("@authTools.checkTestOwnership(#testId)")
|
|
.antMatchers(HttpMethod.GET, "/api/test/delete/{testId}").access("@authTools.checkTestOwnership(#testId)")
|