Pre Merge pull request !201 from 板砖/master

pull/201/MERGE
板砖 3 years ago committed by Gitee
commit e95386d35d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -12,6 +12,7 @@
<url>http://www.ruoyi.vip</url> <url>http://www.ruoyi.vip</url>
<description>若依微服务系统</description> <description>若依微服务系统</description>
<properties> <properties>
<ruoyi.version>3.5.0</ruoyi.version> <ruoyi.version>3.5.0</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -1,9 +1,10 @@
package com.ruoyi.modules.monitor.config; package com.ruoyi.modules.monitor.config;
import de.codecentric.boot.admin.server.config.AdminServerProperties; import de.codecentric.boot.admin.server.config.AdminServerProperties;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
/** /**
@ -11,8 +12,8 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti
* *
* @author ruoyi * @author ruoyi
*/ */
@Configuration @EnableWebSecurity
public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter public class WebSecurityConfigurer
{ {
private final String adminContextPath; private final String adminContextPath;
@ -21,14 +22,14 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter
this.adminContextPath = adminServerProperties.getContextPath(); this.adminContextPath = adminServerProperties.getContextPath();
} }
@Override @Bean
protected void configure(HttpSecurity http) throws Exception public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception
{ {
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo"); successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl(adminContextPath + "/"); successHandler.setDefaultTargetUrl(adminContextPath + "/");
http return httpSecurity
.headers().frameOptions().disable() .headers().frameOptions().disable()
.and().authorizeRequests() .and().authorizeRequests()
.antMatchers(adminContextPath + "/assets/**" .antMatchers(adminContextPath + "/assets/**"
@ -44,6 +45,7 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter
.and() .and()
.httpBasic().and() .httpBasic().and()
.csrf() .csrf()
.disable(); .disable()
.build();
} }
} }

Loading…
Cancel
Save