删除权限验证

duhanyu
dongdingding 1 year ago
parent 69b6362fe3
commit 336980d76c

@ -24,7 +24,7 @@ import java.util.List;
* @date 2023-10-13 * @date 2023-10-13
*/ */
@RestController @RestController
@Api("词云") @Api(tags = "词云")
@RequestMapping("/tcZz/netWorkYq/cy") @RequestMapping("/tcZz/netWorkYq/cy")
public class TcCyController extends BaseController { public class TcCyController extends BaseController {
@Autowired @Autowired

@ -112,7 +112,7 @@ public class TcWljgController extends BaseController
/** /**
* *
*/ */
@ApiOperation(value = "查询舆情走势图列表",response = TcWljg.class) @ApiOperation(value = "查询网络监测列表",response = TcWljg.class)
@GetMapping("/ListNoToken") @GetMapping("/ListNoToken")
public TableDataInfo ListNoToken(TcWljg tcWljg) public TableDataInfo ListNoToken(TcWljg tcWljg)
{ {

@ -30,7 +30,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @author ruoyi * @author ruoyi
* @date 2023-10-13 * @date 2023-10-13
*/ */
@Api("舆情走势图") @Api(tags = "舆情走势图")
@RestController @RestController
@RequestMapping("/tcZz/netWorkYq/yqzs") @RequestMapping("/tcZz/netWorkYq/yqzs")
public class TcYqzsController extends BaseController public class TcYqzsController extends BaseController

@ -1,5 +1,9 @@
package com.ruoyi.framework.config; 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.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod; 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.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.logout.LogoutFilter; import org.springframework.security.web.authentication.logout.LogoutFilter;
import org.springframework.web.filter.CorsFilter; 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 * spring security
* *
* @author ruoyi * @author ruoyi
*/ */
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter public class SecurityConfig extends WebSecurityConfigurerAdapter {
{
/** /**
* *
*/ */
@Autowired @Autowired
private UserDetailsService userDetailsService; private UserDetailsService userDetailsService;
/** /**
* *
*/ */
@ -51,7 +50,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
*/ */
@Autowired @Autowired
private JwtAuthenticationTokenFilter authenticationTokenFilter; private JwtAuthenticationTokenFilter authenticationTokenFilter;
/** /**
* *
*/ */
@ -72,8 +71,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
*/ */
@Bean @Bean
@Override @Override
public AuthenticationManager authenticationManagerBean() throws Exception public AuthenticationManager authenticationManagerBean() throws Exception {
{
return super.authenticationManagerBean(); return super.authenticationManagerBean();
} }
@ -93,8 +91,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
* authenticated | 访 * authenticated | 访
*/ */
@Override @Override
protected void configure(HttpSecurity httpSecurity) throws Exception protected void configure(HttpSecurity httpSecurity) throws Exception {
{
// 注解标记允许匿名访问的url // 注解标记允许匿名访问的url
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests(); ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests();
permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll()); permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll());
@ -113,13 +110,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 对于登录login 注册register 验证码captchaImage 允许匿名访问 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage").permitAll() .antMatchers("/login", "/register", "/captchaImage").permitAll()
// 静态资源,可匿名访问 // 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**",
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/tcZz/cy/**n","/tcZz/yqzs/**", "/tcZz/netWorkYq/yqzs/ListNoToken", "/tcZz/netWorkYq/cy/ListNoToken",
"/tcZz/networkSecurity/cybersecurity/**","/tcZz/networkSecurity/xtjc/**", "/tcZz/networkSecurity/cybersecurity/ListNoToken", "/tcZz/networkSecurity/cybersecurity/ListNoToken",
"/tcZz/networkSecurity/jgdw/**","/tcZz/netWorkYq/yqxxltj/**","/tcZz/netWorkYq/yqxxltj/**", "/tcZz/networkSecurity/jgdw/ListNoToken",
"/tcZz/yqzs/ListNoToken","/tcZz/cy/ListNoToken", "/tcZz/networkSecurity/xtjc/ListNoToken", "/tcZz/netWorkYq/yqxxltj/ListNoToken").permitAll()
"/tcZz/networkSecurity/cybersecurity/ListNoToken","/tcZz/networkSecurity/jgdw/ListNoToken", .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**"
"/tcZz/networkSecurity/xtjc/ListNoToken","/tcZz/netWorkYq/yqxxltj/ListNoToken").permitAll() ).permitAll()
// 除上面外的所有请求全部需要鉴权认证 // 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated() .anyRequest().authenticated()
.and() .and()
@ -137,8 +134,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
* *
*/ */
@Bean @Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() public BCryptPasswordEncoder bCryptPasswordEncoder() {
{
return new BCryptPasswordEncoder(); return new BCryptPasswordEncoder();
} }
@ -146,8 +142,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
* *
*/ */
@Override @Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception protected void configure(AuthenticationManagerBuilder auth) throws Exception {
{
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
} }
} }

Loading…
Cancel
Save