diff --git a/wise-api/pom.xml b/wise-api/pom.xml index e3a3a406..549f5e29 100644 --- a/wise-api/pom.xml +++ b/wise-api/pom.xml @@ -5,7 +5,6 @@ org.springframework.boot spring-boot-starter-parent 3.2.1 - org.wisemapping @@ -85,12 +84,6 @@ 12.0 compile - - org.apache.tomcat.embed - tomcat-embed-jasper - 10.1.9 - provided - org.postgresql postgresql @@ -149,6 +142,7 @@ 2.7.1 runtime + com.fasterxml.jackson.core jackson-databind @@ -161,13 +155,6 @@ 2.0.1 - - jakarta.servlet - jakarta.servlet-api - 6.0.0 - provided - - commons-io commons-io @@ -183,10 +170,11 @@ org.projectlombok lombok - RELEASE + 1.18.26 compile + io.jsonwebtoken jjwt-api @@ -197,7 +185,6 @@ jjwt-impl 0.11.5 - io.jsonwebtoken jjwt-jackson @@ -233,4 +220,14 @@ + + + spring-snapshots + https://repo.spring.io/snapshot + + + spring-milestones + https://repo.spring.io/milestone + + \ No newline at end of file diff --git a/wise-api/src/main/java/com/wisemapping/rest/AccountController.java b/wise-api/src/main/java/com/wisemapping/rest/AccountController.java index c82d1372..52a870dc 100644 --- a/wise-api/src/main/java/com/wisemapping/rest/AccountController.java +++ b/wise-api/src/main/java/com/wisemapping/rest/AccountController.java @@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; @RestController +@RequestMapping("/api/restfull/account/") @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") public class AccountController extends BaseController { @Qualifier("userService") @@ -53,7 +54,7 @@ public class AccountController extends BaseController { @Autowired private LabelService labelService; - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/account/password", consumes = {"text/plain"}) + @RequestMapping(method = RequestMethod.PUT, value = "password", consumes = {"text/plain"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void changePassword(@RequestBody String password) throws PasswordTooLongException { if (password == null) { @@ -69,13 +70,13 @@ public class AccountController extends BaseController { userService.changePassword(user); } - @RequestMapping(method = RequestMethod.GET, value = "/api/restfull/account", produces = {"application/json"}) + @RequestMapping(method = RequestMethod.GET, value = "", produces = {"application/json"}) public RestUser fetchAccount() { final User user = Utils.getUser(true); return new RestUser(user); } - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/account/firstname", consumes = {"text/plain"}) + @RequestMapping(method = RequestMethod.PUT, value = "firstname", consumes = {"text/plain"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void changeFirstname(@RequestBody String firstname) { if (firstname == null) { @@ -87,7 +88,7 @@ public class AccountController extends BaseController { userService.updateUser(user); } - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/account/lastname", consumes = {"text/plain"}) + @RequestMapping(method = RequestMethod.PUT, value = "lastname", consumes = {"text/plain"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void changeLastName(@RequestBody String lastname) { if (lastname == null) { @@ -99,7 +100,7 @@ public class AccountController extends BaseController { userService.updateUser(user); } - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/account/locale", consumes = {"text/plain"}) + @RequestMapping(method = RequestMethod.PUT, value = "locale", consumes = {"text/plain"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void changeLanguage(@RequestBody String language) { if (language == null) { @@ -113,7 +114,7 @@ public class AccountController extends BaseController { } @ResponseStatus(value = HttpStatus.NO_CONTENT) - @RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/account") + @RequestMapping(method = RequestMethod.DELETE, value = "") public void deleteUser() throws WiseMappingException { // Delete collaborations ... final User user = Utils.getUser(true); diff --git a/wise-api/src/main/java/com/wisemapping/rest/AdminController.java b/wise-api/src/main/java/com/wisemapping/rest/AdminController.java index cd199ad5..ec2638d5 100644 --- a/wise-api/src/main/java/com/wisemapping/rest/AdminController.java +++ b/wise-api/src/main/java/com/wisemapping/rest/AdminController.java @@ -37,6 +37,7 @@ import java.io.IOException; import java.util.List; @RestController +@RequestMapping("/api/restfull/admin/") @PreAuthorize("isAuthenticated() and hasRole('ROLE_ADMIN')") public class AdminController extends BaseController { @Qualifier("userService") @@ -47,7 +48,7 @@ public class AdminController extends BaseController { @Autowired private MindmapService mindmapService; - @RequestMapping(method = RequestMethod.GET, value = "/api/restfull/admin/users/{id}", produces = {"application/json"}) + @RequestMapping(method = RequestMethod.GET, value = "users/{id}", produces = {"application/json"}) @ResponseBody public RestUser getUserById(@PathVariable int id) throws IOException { final User userBy = userService.getUserBy(id); @@ -57,7 +58,7 @@ public class AdminController extends BaseController { return new RestUser(userBy); } - @RequestMapping(method = RequestMethod.GET, value = "/api/restfull/admin/users/email/{email:.+}", produces = {"application/json"}) + @RequestMapping(method = RequestMethod.GET, value = "users/email/{email:.+}", produces = {"application/json"}) @ResponseBody public RestUser getUserByEmail(@PathVariable String email) throws IOException { final User user = userService.getUserBy(email); @@ -67,7 +68,7 @@ public class AdminController extends BaseController { return new RestUser(user); } - @RequestMapping(method = RequestMethod.POST, value = "/api/restfull/admin/users", consumes = {"application/json"}, produces = {"application/json"}) + @RequestMapping(method = RequestMethod.POST, value = "users", consumes = {"application/json"}, produces = {"application/json"}) @ResponseStatus(value = HttpStatus.CREATED) public void createUser(@RequestBody RestUser user, HttpServletResponse response) throws WiseMappingException { if (user == null) { @@ -104,7 +105,7 @@ public class AdminController extends BaseController { response.setHeader("Location", "/api/restfull/admin/users/" + user.getId()); } - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/admin/users/{id}/password", consumes = {"text/plain"}) + @RequestMapping(method = RequestMethod.PUT, value = "users/{id}/password", consumes = {"text/plain"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void changePassword(@RequestBody String password, @PathVariable int id) throws WiseMappingException { if (password == null) { @@ -119,7 +120,7 @@ public class AdminController extends BaseController { userService.changePassword(user); } - @RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/admin/users/{id}") + @RequestMapping(method = RequestMethod.DELETE, value = "users/{id}") @ResponseStatus(value = HttpStatus.NO_CONTENT) public void deleteUserByEmail(@PathVariable int id) throws WiseMappingException { final User user = userService.getUserBy(id); diff --git a/wise-api/src/main/java/com/wisemapping/rest/MindmapController.java b/wise-api/src/main/java/com/wisemapping/rest/MindmapController.java index a8ea9da2..3bf17a74 100644 --- a/wise-api/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-api/src/main/java/com/wisemapping/rest/MindmapController.java @@ -48,7 +48,7 @@ import java.util.stream.Collectors; @RestController -@Transactional(propagation = Propagation.REQUIRED) +//@RequestMapping("/api/restfull/labels") public class MindmapController extends BaseController { private final Logger logger = LogManager.getLogger();