Update spring boot

This commit is contained in:
2022-12-07 18:23:54 +01:00
parent 01d9c2d187
commit fabd70fe56
5 changed files with 29 additions and 253 deletions
@@ -14,8 +14,8 @@ import org.springframework.http.HttpStatus;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.argon2.Argon2PasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.HttpStatusEntryPoint;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
@@ -37,7 +37,7 @@ import de.bstly.board.businesslogic.UserManager;
*/
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
public class SecurityConfig {
@Autowired
private UserManager localUserManager;
@@ -50,18 +50,15 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Value("${loginTargetUrl:/}")
private String loginTargetUrl;
/*
* @see org.springframework.security.config.annotation.web.configuration.
* WebSecurityConfigurerAdapter#configure(org.springframework.security.config.
* annotation.web.builders.HttpSecurity)
/**
* Security filter chain.
*
* @param http the http
* @return the security filter chain
* @throws Exception the exception
*/
/*
* @see org.springframework.security.config.annotation.web.configuration.
* WebSecurityConfigurerAdapter#configure(org.springframework.security.config.
* annotation.web.builders.HttpSecurity)
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
oAuth2AuthenticationSuccessHandler.setDefaultTargetUrl(loginTargetUrl);
oAuth2AuthenticationSuccessHandler.setRememberMeServices(rememberMeServices());
@@ -90,6 +87,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.oauth2Login().successHandler(oAuth2AuthenticationSuccessHandler)
.failureHandler(new SimpleUrlAuthenticationFailureHandler(loginUrl + "?externalError"))
.loginPage("/login");
return http.build();
}
/**