From 5eb4771da9f91e1619caebc8b25fcddbdb8b6782 Mon Sep 17 00:00:00 2001 From: Baptiste Toulemonde <toulemonde@cines.fr> Date: Thu, 14 Oct 2021 17:25:50 +0200 Subject: [PATCH] add getcatalogsid --- .../config/SmartHarvesterSecurityConfiguration.java | 1 + .../controller/SmartHarvesterCatalogController.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/com/smartharvester/config/SmartHarvesterSecurityConfiguration.java b/src/main/java/com/smartharvester/config/SmartHarvesterSecurityConfiguration.java index e9d3a71..614245e 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 1298c64..ff056cc 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())); + } } -- GitLab