From 336980d76cbfcb2575e307e8d1f195cac7bb1695 Mon Sep 17 00:00:00 2001 From: dongdingding <207595406@qq.com> Date: Mon, 16 Oct 2023 08:55:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9D=83=E9=99=90=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/tcZz/controller/TcCyController.java | 2 +- .../tcZz/controller/TcWljgController.java | 2 +- .../tcZz/controller/TcYqzsController.java | 2 +- .../framework/config/SecurityConfig.java | 43 ++++++++----------- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java index f8b49faf..18ce4c8a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java @@ -24,7 +24,7 @@ import java.util.List; * @date 2023-10-13 */ @RestController -@Api("词云") +@Api(tags = "词云") @RequestMapping("/tcZz/netWorkYq/cy") public class TcCyController extends BaseController { @Autowired diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcWljgController.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcWljgController.java index bfd02c23..62729e69 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcWljgController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcWljgController.java @@ -112,7 +112,7 @@ public class TcWljgController extends BaseController /** * 查询网络监测列表 */ - @ApiOperation(value = "查询舆情走势图列表",response = TcWljg.class) + @ApiOperation(value = "查询网络监测列表",response = TcWljg.class) @GetMapping("/ListNoToken") public TableDataInfo ListNoToken(TcWljg tcWljg) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcYqzsController.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcYqzsController.java index 4157bafb..80775a53 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcYqzsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcYqzsController.java @@ -30,7 +30,7 @@ import com.ruoyi.common.core.page.TableDataInfo; * @author ruoyi * @date 2023-10-13 */ -@Api("舆情走势图") +@Api(tags = "舆情走势图") @RestController @RequestMapping("/tcZz/netWorkYq/yqzs") public class TcYqzsController extends BaseController diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 2c003d6b..424f3e29 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -1,5 +1,9 @@ package com.ruoyi.framework.config; +import com.ruoyi.framework.config.properties.PermitAllUrlProperties; +import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; +import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl; +import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.http.HttpMethod; @@ -15,25 +19,20 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.logout.LogoutFilter; import org.springframework.web.filter.CorsFilter; -import com.ruoyi.framework.config.properties.PermitAllUrlProperties; -import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; -import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl; -import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; /** * spring security配置 - * + * * @author ruoyi */ @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) -public class SecurityConfig extends WebSecurityConfigurerAdapter -{ +public class SecurityConfig extends WebSecurityConfigurerAdapter { /** * 自定义用户认证逻辑 */ @Autowired private UserDetailsService userDetailsService; - + /** * 认证失败处理类 */ @@ -51,7 +50,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private JwtAuthenticationTokenFilter authenticationTokenFilter; - + /** * 跨域过滤器 */ @@ -72,8 +71,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Bean @Override - public AuthenticationManager authenticationManagerBean() throws Exception - { + public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @@ -93,8 +91,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter * authenticated | 用户登录后可访问 */ @Override - protected void configure(HttpSecurity httpSecurity) throws Exception - { + protected void configure(HttpSecurity httpSecurity) throws Exception { // 注解标记允许匿名访问的url ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests(); permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll()); @@ -113,13 +110,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter // 对于登录login 注册register 验证码captchaImage 允许匿名访问 .antMatchers("/login", "/register", "/captchaImage").permitAll() // 静态资源,可匿名访问 - .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() - .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/tcZz/cy/**n","/tcZz/yqzs/**", - "/tcZz/networkSecurity/cybersecurity/**","/tcZz/networkSecurity/xtjc/**", - "/tcZz/networkSecurity/jgdw/**","/tcZz/netWorkYq/yqxxltj/**","/tcZz/netWorkYq/yqxxltj/**", - "/tcZz/yqzs/ListNoToken","/tcZz/cy/ListNoToken", - "/tcZz/networkSecurity/cybersecurity/ListNoToken","/tcZz/networkSecurity/jgdw/ListNoToken", - "/tcZz/networkSecurity/xtjc/ListNoToken","/tcZz/netWorkYq/yqxxltj/ListNoToken").permitAll() + .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**", + "/tcZz/netWorkYq/yqzs/ListNoToken", "/tcZz/netWorkYq/cy/ListNoToken", + "/tcZz/networkSecurity/cybersecurity/ListNoToken", "/tcZz/networkSecurity/cybersecurity/ListNoToken", + "/tcZz/networkSecurity/jgdw/ListNoToken", + "/tcZz/networkSecurity/xtjc/ListNoToken", "/tcZz/netWorkYq/yqxxltj/ListNoToken").permitAll() + .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**" + ).permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated() .and() @@ -137,8 +134,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter * 强散列哈希加密实现 */ @Bean - public BCryptPasswordEncoder bCryptPasswordEncoder() - { + public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } @@ -146,8 +142,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter * 身份认证接口 */ @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception - { + protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); } }