Skip to content

Commit 80f5a55

Browse files
committed
Update WebSecurityConfig.java for Spring Security 6.x compatibility
1 parent cd8f9dc commit 80f5a55

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import org.springframework.context.annotation.Bean;
2+
import org.springframework.context.annotation.Configuration;
3+
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
4+
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
5+
import org.springframework.security.web.SecurityFilterChain;
6+
7+
@Configuration
8+
@EnableWebSecurity
9+
public class WebSecurityConfig {
10+
11+
@Bean
12+
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
13+
http
14+
.authorizeHttpRequests()
15+
.requestMatchers("/public/**").permitAll() // Update according to your requirements
16+
.anyRequest().authenticated()
17+
.and()
18+
.formLogin()
19+
.and()
20+
.logout();
21+
22+
return http.build();
23+
}
24+
}

0 commit comments

Comments
 (0)