Fix: opened an endpoint on announcements.

This commit is contained in:
Jose
2026-01-22 13:45:39 +01:00
parent 2523b22043
commit b214b77791
2 changed files with 6 additions and 7 deletions

View File

@@ -37,16 +37,16 @@ public class SecurityConfig {
.csrf(csrf -> csrf.disable()) .csrf(csrf -> csrf.disable())
.sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.exceptionHandling(ex -> ex .exceptionHandling(ex -> ex
.authenticationEntryPoint(authEntryPoint) .authenticationEntryPoint(authEntryPoint)
.accessDeniedHandler(accessDeniedHandler) .accessDeniedHandler(accessDeniedHandler)
) )
.authorizeHttpRequests(auth -> auth .authorizeHttpRequests(auth -> auth
// PUBLICAS // PUBLICAS
.requestMatchers("/login").permitAll() .requestMatchers("/login").permitAll()
.requestMatchers("/announces").permitAll() .requestMatchers("/announcements").permitAll()
.requestMatchers("/requests").permitAll() .requestMatchers("/requests/mine").permitAll()
.requestMatchers("/huertos/users/waitlist/limited").permitAll() .requestMatchers("/users/waitlist/limited").permitAll()
.requestMatchers("/huertos/users/latest-number").permitAll() .requestMatchers("/users/latest-number").permitAll()
// PRIVADAS // PRIVADAS
.anyRequest().authenticated() .anyRequest().authenticated()
); );

View File

@@ -23,7 +23,6 @@ public class AnnouncementController {
} }
@GetMapping @GetMapping
@PreAuthorize("hasAnyRole('HUERTOS_ROLE_ADMIN', 'HUERTOS_ROLE_DEV')")
public ResponseEntity<List<AnnouncementDto.Response>> getAll() { public ResponseEntity<List<AnnouncementDto.Response>> getAll() {
return ResponseEntity.ok( return ResponseEntity.ok(
announcementService.getAll() announcementService.getAll()