diff --git a/src/main/java/com/smartharvester/config/SmartHarvesterSecurityConfiguration.java b/src/main/java/com/smartharvester/config/SmartHarvesterSecurityConfiguration.java index e9d3a71ebf3631c4833bbb2bda6e7b46f123225c..614245e2ff96062cab374a4a8dc89d983ccfbe0c 100644 --- a/src/main/java/com/smartharvester/config/SmartHarvesterSecurityConfiguration.java +++ b/src/main/java/com/smartharvester/config/SmartHarvesterSecurityConfiguration.java @@ -56,6 +56,7 @@ public class SmartHarvesterSecurityConfiguration extends WebSecurityConfigurerAd .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() .authorizeRequests().antMatchers("/harvester/auth/**").permitAll().and() + .authorizeRequests().antMatchers("/harvester/api/catalogs").permitAll().and() .authorizeRequests().antMatchers("/resources/**", "/public/error/css/**").permitAll() .antMatchers("/harvester/api/**").authenticated() .antMatchers("/public/error/css/**").permitAll().and() diff --git a/src/main/java/com/smartharvester/controller/SmartHarvesterCatalogController.java b/src/main/java/com/smartharvester/controller/SmartHarvesterCatalogController.java index 1298c6474f54436413aa40733a8f293d9c8d4f88..ff056ccfc3cb83e08306d86fd24a6b9cb2918d03 100644 --- a/src/main/java/com/smartharvester/controller/SmartHarvesterCatalogController.java +++ b/src/main/java/com/smartharvester/controller/SmartHarvesterCatalogController.java @@ -24,6 +24,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.*; +import java.util.stream.Collectors; @CrossOrigin(origins = "*") @RestController @@ -55,5 +56,10 @@ public class SmartHarvesterCatalogController { return ResponseEntity.ok(new MessageResponse("Catalog deleted succefully!",HttpStatus.OK)); } + + @GetMapping + public ResponseEntity<List<String>> getAll() { + return ResponseEntity.ok(catalogDoaRepository.findAll().stream().map(catalog -> catalog.getCatId()).collect(Collectors.toList())); + } }