JAVA-29288 Upgrade spring-security-cognito (#15839)

Co-authored-by: timis1 <noreplay@yahoo.com>
This commit is contained in:
timis1 2024-02-11 23:56:43 +02:00 committed by GitHub
parent 10f477e635
commit 4a229ecfe5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 9 deletions

View File

@ -11,7 +11,8 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>spring-security-modules</artifactId> <artifactId>parent-boot-3</artifactId>
<relativePath>../../parent-boot-3</relativePath>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>
@ -30,7 +31,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.thymeleaf.extras</groupId> <groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId> <artifactId>thymeleaf-extras-springsecurity6</artifactId>
</dependency> </dependency>
<!-- oauth2 --> <!-- oauth2 -->
<dependency> <dependency>

View File

@ -2,6 +2,7 @@ package com.baeldung.cognito;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.SecurityFilterChain;
@ -10,16 +11,13 @@ public class SecurityConfiguration {
@Bean @Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.csrf() http.csrf(Customizer.withDefaults())
.and() .authorizeHttpRequests(authz -> authz.requestMatchers("/")
.authorizeRequests(authz -> authz.mvcMatchers("/")
.permitAll() .permitAll()
.anyRequest() .anyRequest()
.authenticated()) .authenticated())
.oauth2Login() .oauth2Login(Customizer.withDefaults())
.and() .logout(httpSecurityLogoutConfigurer -> httpSecurityLogoutConfigurer.logoutSuccessUrl("/"));
.logout()
.logoutSuccessUrl("/");
return http.build(); return http.build();
} }
} }