Spaces:
Sleeping
Sleeping
| package com.cs102.attendance.config; | |
| import org.springframework.context.annotation.Bean; | |
| 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.web.SecurityFilterChain; | |
| public class SecurityConfig { | |
| public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { | |
| http | |
| .csrf(csrf -> csrf.disable()) // Disable CSRF for simplicity | |
| .authorizeHttpRequests(auth -> auth | |
| .requestMatchers("/call-face-recognition").permitAll() | |
| .anyRequest().authenticated() | |
| ) | |
| .httpBasic(Customizer.withDefaults()); // or formLogin/custom config | |
| return http.build(); | |
| } | |
| } | |