Update SecurityConfig.java
This commit is contained in:
parent
ba239764bf
commit
2e0c93a400
@ -33,15 +33,13 @@ public class SecurityConfig {
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
|
||||
// TODO: Fix security config for this project (currently old state from sharepulse)
|
||||
|
||||
http
|
||||
.csrf(csrf -> csrf.ignoringRequestMatchers("/api/v1/**")) // Disable CSRF for API routes
|
||||
.sessionManagement(sessionManagement -> sessionManagement
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS) // No session will be created by Spring Security
|
||||
)
|
||||
.authorizeHttpRequests(authorize -> authorize
|
||||
.requestMatchers("/api/v1/secure/**").authenticated() // Secure these endpoints
|
||||
.requestMatchers("/api/v1/**").authenticated() // Secure all /api/v1/** routes
|
||||
.anyRequest().permitAll() // All other requests are allowed without authentication
|
||||
)
|
||||
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) // Apply JWT filter
|
||||
|
Loading…
x
Reference in New Issue
Block a user