@@ -51,9 +51,9 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
5151 .requestMatchers ("/api/auth/**" ).permitAll ()
5252 .requestMatchers ("/api/health" ).permitAll ()
5353 .requestMatchers ("/api/admin/health" ).permitAll ()
54- .requestMatchers ("/api/facial/health" ).permitAll () // ML service health check
55- .requestMatchers ("/api/call-analysis/health" ).permitAll () // ML service health check
56-
54+ .requestMatchers ("/api/facial/health" ).permitAll () // ML service health check
55+ .requestMatchers ("/api/call-analysis/health" ).permitAll () // ML service health check
56+
5757 // ML Service endpoints
5858 .requestMatchers ("/api/call-analysis/**" ).hasRole ("Investigator" )
5959 .requestMatchers ("/api/facial/register" ).hasAnyRole ("Investigator" , "OIC" )
@@ -63,7 +63,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
6363 // Criminal CRUD (direct DB, no Python)
6464 .requestMatchers ("/api/criminals/**" ).hasAnyRole ("Investigator" , "OIC" )
6565 .requestMatchers ("/api/criminals" ).hasAnyRole ("Investigator" , "OIC" )
66-
66+
6767 .requestMatchers ("/api/database/**" ).permitAll ()
6868 .requestMatchers ("/api/test" ).permitAll ()
6969 .requestMatchers ("/api/debug/**" ).permitAll () // 🔍 Debug endpoints
@@ -90,9 +90,14 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
9090
9191 // Admin/OIC/Investigator routes (officer data, locations, users)
9292 .requestMatchers ("/api/users/field-officers" ).hasAnyRole ("Admin" , "OIC" , "Investigator" )
93- .requestMatchers ("/api/admin/officers/*/locations/**" ).hasAnyRole ("Admin" , "OIC" , "Investigator" )
93+ .requestMatchers ("/api/admin/officers/*/locations/**" )
94+ .hasAnyRole ("Admin" , "OIC" , "Investigator" )
9495 .requestMatchers ("/api/admin/**" ).hasAnyRole ("OIC" , "Admin" )
9596
97+ // Officer announcements
98+ .requestMatchers ("/api/announcements" ).hasAnyRole ("OIC" , "FieldOfficer" )
99+ .requestMatchers ("/api/announcements/**" ).hasRole ("OIC" )
100+
96101 .anyRequest ().authenticated ())
97102 .exceptionHandling (exception -> exception
98103 .authenticationEntryPoint (new HttpStatusEntryPoint (HttpStatus .UNAUTHORIZED ))
@@ -107,7 +112,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
107112 .addFilterBefore (jwtAuthFilter , UsernamePasswordAuthenticationFilter .class );
108113
109114 return http .build ();
110- }
115+ }
111116
112117 @ Bean
113118 public AuthenticationProvider authenticationProvider () {
@@ -136,8 +141,7 @@ public CorsConfigurationSource corsConfigurationSource() {
136141 configuration .setAllowedOriginPatterns (List .of ("*" ));
137142 } else {
138143 configuration .setAllowedOrigins (
139- Arrays .asList (corsAllowedOrigins .split ("," ))
140- );
144+ Arrays .asList (corsAllowedOrigins .split ("," )));
141145 }
142146 configuration .setAllowedMethods (Arrays .asList (
143147 "GET" , "POST" , "PUT" , "DELETE" , "OPTIONS" , "PATCH" ));
0 commit comments