diff --git a/pom.xml b/pom.xml index aa4fe9053d528c6902194c7e6aed8cbdc1ee3079..2b3ff05d3b5eaf202ba52c5cfcdd3a1757658f8a 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,10 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-validation</artifactId> + </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> @@ -32,9 +36,9 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>io.swagger.core.v3</groupId> - <artifactId>swagger-annotations</artifactId> - <version>2.2.8</version> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + <version>2.1.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/config/SecurityConfig.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/config/SecurityConfig.java index ce4bc75eb8e0f3e7af774474176a756c1627f1ee..582c9171d2fe6cf2c4d99f685c3fd5b5334aa2a2 100644 --- a/src/main/java/ntnu/idatt2016/v233/SmartMat/config/SecurityConfig.java +++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/config/SecurityConfig.java @@ -35,6 +35,8 @@ public class SecurityConfig { .authorizeHttpRequests(auth-> auth .requestMatchers(HttpMethod.POST, "api/auth/**").permitAll() .requestMatchers(HttpMethod.POST, "api/user/**").permitAll() + .requestMatchers(HttpMethod.GET, "swagger-ui/**").permitAll() + .requestMatchers(HttpMethod.GET, "/v3/api-docs/**").permitAll() .anyRequest().authenticated() ) .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt) diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/ShoppingListController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/ShoppingListController.java index 3dad7b26c11812b4e56689f16430d28bb2c83a17..04f97f187ec4a7ccd3134760a71ac55bda5c749e 100644 --- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/ShoppingListController.java +++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/ShoppingListController.java @@ -5,12 +5,9 @@ import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + -import io.swagger.v3.oas.annotations.parameters.RequestBody; import lombok.AllArgsConstructor; import ntnu.idatt2016.v233.SmartMat.dto.request.ShoppingListRequest; import ntnu.idatt2016.v233.SmartMat.entity.ShoppingList;