From 2944ea778f0fc87c8e09ae47200d9de8069049e3 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 26 十二月 2025 10:46:37 +0800
Subject: [PATCH] 代码提交
---
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java | 30 +++++++++++++-----------------
1 files changed, 13 insertions(+), 17 deletions(-)
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 523258e..b8b1fda 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
@@ -25,8 +25,7 @@
* @author ruoyi
*/
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
-public class SecurityConfig extends WebSecurityConfigurerAdapter
-{
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
/**
* 鑷畾涔夌敤鎴疯璇侀�昏緫
*/
@@ -60,6 +59,7 @@
@Autowired
private WxOpenIDAuthenticationSecurityConfig wxOpenIDAuthenticationSecurityConfig;
+
/**
* 瑙e喅 鏃犳硶鐩存帴娉ㄥ叆 AuthenticationManager
*
@@ -68,8 +68,7 @@
*/
@Bean
@Override
- public AuthenticationManager authenticationManagerBean() throws Exception
- {
+ public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@@ -89,8 +88,7 @@
* authenticated | 鐢ㄦ埛鐧诲綍鍚庡彲璁块棶
*/
@Override
- protected void configure(HttpSecurity httpSecurity) throws Exception
- {
+ protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
//寰俊openid娉ㄥ叆
.apply(wxOpenIDAuthenticationSecurityConfig).and()
@@ -103,20 +101,20 @@
// 杩囨护璇锋眰
.authorizeRequests()
// 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶
- .antMatchers("/login","/openidlogin", "/register", "/captchaImage", "/getToken").anonymous()
+ .antMatchers("/login", "/openidlogin", "/register", "/captchaImage", "/getToken").anonymous()
.antMatchers(
HttpMethod.GET,
"/",
"/*.html",
"/**/*.html",
"/**/*.css",
- "/**/*.js"
-// "/profile/**"
+ "/**/*.js",
+ "/profile/**"
).permitAll()
-// .antMatchers("/swagger-ui.html").anonymous()
-// .antMatchers("/swagger-resources/**").anonymous()
-// .antMatchers("/webjars/**").anonymous()
-// .antMatchers("/*/api-docs").anonymous()
+ .antMatchers("/swagger-ui.html").permitAll()
+ .antMatchers("/swagger-resources/**").permitAll()
+ .antMatchers("/webjars/**").permitAll()
+ .antMatchers("/*/api-docs").permitAll()
// .antMatchers("/druid/**").anonymous()
// 闄や笂闈㈠鐨勬墍鏈夎姹傚叏閮ㄩ渶瑕侀壌鏉冭璇�
.anyRequest().authenticated()
@@ -134,8 +132,7 @@
* 寮烘暎鍒楀搱甯屽姞瀵嗗疄鐜�
*/
@Bean
- public BCryptPasswordEncoder bCryptPasswordEncoder()
- {
+ public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
@@ -143,8 +140,7 @@
* 韬唤璁よ瘉鎺ュ彛
*/
@Override
- protected void configure(AuthenticationManagerBuilder auth) throws Exception
- {
+ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
}
}
--
Gitblit v1.9.3