From 9eefde97a387dd088a7eb3ef6203c4eee3436472 Mon Sep 17 00:00:00 2001 From: freddyheredia4 Date: Sun, 4 Jun 2023 18:28:18 -0500 Subject: [PATCH] cambia puerto y agrega control de permiso en controller --- .../java/pedidos/pedidos/core/producto/ProductoController.java | 2 ++ src/main/resources/application.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/pedidos/pedidos/core/producto/ProductoController.java b/src/main/java/pedidos/pedidos/core/producto/ProductoController.java index 425a172..94938b1 100644 --- a/src/main/java/pedidos/pedidos/core/producto/ProductoController.java +++ b/src/main/java/pedidos/pedidos/core/producto/ProductoController.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.lang.reflect.Field; import java.util.Map; +import org.springframework.security.access.prepost.PreAuthorize; @RestController @RequestMapping("api/producto") @@ -21,6 +22,7 @@ import java.util.Map; public class ProductoController { @Autowired ProductoService productoService; + @PreAuthorize("hasAuthority('Product_Read')") @GetMapping("/") public List findAll(){ return productoService.findAll(); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f04ccfb..9c1fb43 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -4,4 +4,4 @@ spring.datasource.password=postgres spring.jpa.hibernate.ddl-auto=update #spring.jpa.show-sql=true #spring.sql.init.mode=always -server.port=8081 \ No newline at end of file +server.port=8082 \ No newline at end of file