diff --git a/openspec/changes/add-admin-auth-users-roles/tasks.md b/openspec/changes/add-admin-auth-users-roles/tasks.md index 08e485b..4be15f7 100644 --- a/openspec/changes/add-admin-auth-users-roles/tasks.md +++ b/openspec/changes/add-admin-auth-users-roles/tasks.md @@ -45,9 +45,9 @@ Babyboo source: `~/Projects/babyboo` (read only). All tasks run serially; most t ## 8. Review follow-up: close self-escalation -- [ ] 8.1 In `mobile-api`: delete `POST /api/admin/users/{id}/changePassword` and `AdminUserService.changePassword`; in `AdminUserService` refuse (403, `OWN_ROLES`) a non-super caller whose update changes the role set on their own account, and refuse (400, `UNKNOWN_ROLE`) `ROLE_ADMIN` or `ROLE_MEMBER` on create and update; in `AdminAclService.updateGrants` refuse (403, `OWN_ROLE`) a non-super caller editing a role they hold, and delete `requireNoLockout`, which that rule makes unreachable. Tests first for each new scenario. Verify: `mvn -T 1C -B -q -pl solvway-mobile-api -am verify` exits 0. +- [x] 8.1 In `mobile-api`: delete `POST /api/admin/users/{id}/changePassword` and `AdminUserService.changePassword`; in `AdminUserService` refuse (403, `OWN_ROLES`) a non-super caller whose update changes the role set on their own account, and refuse (400, `UNKNOWN_ROLE`) `ROLE_ADMIN` or `ROLE_MEMBER` on create and update; in `AdminAclService.updateGrants` refuse (403, `OWN_ROLE`) a non-super caller editing a role they hold, and delete `requireNoLockout`, which that rule makes unreachable. Tests first for each new scenario. Verify: `mvn -T 1C -B -q -pl solvway-mobile-api -am verify` exits 0. - Scope: `solvway-mobile-api/src/**/admin/**`, `solvway-mobile-api/src/**/service/Admin*` -- [ ] 8.2 In the portal: delete the change-password route, `ChangePasswordDialog`, `changeAdminUserPassword` and the button on the edit-user page; the emailed reset stays. Verify: `npm run lint && npx tsc --noEmit && npx vitest run` exit 0. +- [x] 8.2 In the portal: delete the change-password route, `ChangePasswordDialog`, `changeAdminUserPassword` and the button on the edit-user page; the emailed reset stays. Verify: `npm run lint && npx tsc --noEmit && npx vitest run` exit 0. - Scope: `solvway-admin-portal/**` ## Workflow follow-up diff --git a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/constant/api/RestApiSystemServiceConstants.java b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/constant/api/RestApiSystemServiceConstants.java index 4ac5e88..d45b0ac 100644 --- a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/constant/api/RestApiSystemServiceConstants.java +++ b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/constant/api/RestApiSystemServiceConstants.java @@ -15,7 +15,6 @@ public class RestApiSystemServiceConstants { public static final String API_REST_SYSTEM_MODULE_ADD_MODULE_ROLE = "/module/addModuleRole/{moduleId}/{roleId}"; public static final String API_REST_SYSTEM_MODULE_DELETE_MODULE_ROLE = "/module/deleteModuleRole/{moduleId}/{roleId}"; public static final String API_REST_SYSTEM_USER_SAVE = "/user/save"; - public static final String API_REST_SYSTEM_USER_UPDATE_USER_PASSWORD = "/user/updateUserPassword"; public static final String API_REST_SYSTEM_USER_FIND_EXIST_BY_USERNAME = "/user/findExistByUsername/{username}"; public static final String API_REST_SYSTEM_USER_FIND_BY_USERNAME_WITH_PASSWORD = "/user/findByUsernameWithPassword/{username}"; public static final String API_REST_SYSTEM_USER_UPDATE_MEMBER_PHONE_VERIFIED = "/user/updatePhoneVerified"; diff --git a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/controller/admin/AdminUserController.java b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/controller/admin/AdminUserController.java index b975191..db02d57 100644 --- a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/controller/admin/AdminUserController.java +++ b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/controller/admin/AdminUserController.java @@ -49,12 +49,6 @@ public class AdminUserController { return ResponseEntity.ok(adminUserService.update(id, request)); } - @AppAuth - @PostMapping("/users/{id}/changePassword") - public ResponseEntity> changePassword(@PathVariable Long id, @RequestBody Map body) { - return ResponseEntity.ok(Map.of("updated", adminUserService.changePassword(id, body.get("password")))); - } - @AppAuth @PostMapping("/users/{id}/resetPassword") public ResponseEntity> resetPassword(@PathVariable Long id) { diff --git a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/AdminAclService.java b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/AdminAclService.java index 9ff6823..c819be0 100644 --- a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/AdminAclService.java +++ b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/AdminAclService.java @@ -22,7 +22,6 @@ import java.util.Set; public class AdminAclService { private static final ParameterizedTypeReference>> MAP_LIST = new ParameterizedTypeReference<>() {}; private static final String AREA = "BO"; - private static final String ROLES_MODULE = "BO_ROLES"; private static final long SUPER_ADMIN_ROLE_ID = 1L; private static final long ROLE_ADMIN_ID = 2L; @@ -45,6 +44,11 @@ public class AdminAclService { User caller = adminAuthenticationService.loadUserByToken(HttpReqRespUtils.getJwtToken()); if (caller == null) throw error(HttpStatus.UNAUTHORIZED, "Not signed in", "UNAUTHORIZED"); + boolean isSuper = caller.getRoles() != null && caller.getRoles().stream().anyMatch(r -> r.getId() != null && r.getId() == SUPER_ADMIN_ROLE_ID); + if (!isSuper && caller.getRoles() != null && caller.getRoles().stream().anyMatch(r -> r.getId() != null && r.getId() != ROLE_ADMIN_ID && r.getId().equals(roleId))) { + throw error(HttpStatus.FORBIDDEN, "You cannot change the access of a role you hold", "OWN_ROLE"); + } + List> modules = modules(); Set known = new HashSet<>(); Set current = new HashSet<>(); @@ -54,7 +58,6 @@ public class AdminAclService { } Set wanted = new HashSet<>(moduleIds); if (!known.containsAll(wanted)) throw error(HttpStatus.BAD_REQUEST, "Unknown back-office module", "UNKNOWN_MODULE"); - requireNoLockout(caller, roleId, wanted, modules); // ponytail: not atomic, adds run before deletes and a failure midway leaves a partial grant; a repeated PUT converges. Upgrade: one services-system endpoint that replaces grants in a transaction. for (Long id : wanted) if (!current.contains(id)) call(RestApiSystemServiceConstants.API_REST_SYSTEM_MODULE_ADD_MODULE_ROLE, id, roleId); @@ -62,18 +65,6 @@ public class AdminAclService { return getGrantTree(roleId); } - /** A non-super caller must still reach BO_ROLES through one of their roles (role 2 is on every admin and grants nothing). */ - private static void requireNoLockout(User caller, Long roleId, Set wanted, List> modules) { - if (caller.getRoles() == null || caller.getRoles().stream().anyMatch(r -> r.getId() != null && r.getId() == SUPER_ADMIN_ROLE_ID)) return; - Set held = new HashSet<>(); - caller.getRoles().stream().map(r -> r.getId()).filter(i -> i != null && i != ROLE_ADMIN_ID).forEach(held::add); - if (!held.contains(roleId)) return; - Map rolesModule = modules.stream().filter(m -> ROLES_MODULE.equals(m.get("name"))).findFirst().orElse(null); - if (rolesModule == null) return; - boolean stillGranted = held.stream().anyMatch(r -> r.equals(roleId) ? wanted.contains(AdminRoleService.idOf(rolesModule)) : grantedTo(rolesModule, r)); - if (!stillGranted) throw error(HttpStatus.BAD_REQUEST, "This change would remove your own access to role management", "ACL_LOCKOUT"); - } - /** Hidden roles (ROLE_MEMBER, ROLE_ADMIN) look absent, as in the role list. */ private void requireVisibleRole(Long roleId) { if (AdminRoleService.isHidden(adminRoleService.find(roleId))) { diff --git a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/AdminUserService.java b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/AdminUserService.java index 0475865..d3db514 100644 --- a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/AdminUserService.java +++ b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/service/AdminUserService.java @@ -17,8 +17,10 @@ import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; /** * Admin users for the portal. Users travel as maps so fields the core {@link User} lacks (status) survive @@ -117,6 +119,7 @@ public class AdminUserService { User caller = caller(); Map user = loadManaged(id, caller); requireSuperToGrant(caller, r.roles()); + requireOwnRolesUnchanged(caller, id, user, r.roles()); if (r.enabled() != null && !r.enabled() && caller.getId() != null && caller.getId().equals(id)) { throw error(HttpStatus.BAD_REQUEST, "You cannot deactivate your own account", "SELF_DEACTIVATION"); } @@ -143,16 +146,6 @@ public class AdminUserService { return adminAuthenticationService.resetAdminPassword((String) user.get("username"), (String) user.get("email")); } - public int changePassword(Long id, String password) { - loadManaged(id, caller()); - ResponseEntity ent = restTemplateUtil.postForEntity( - url(RestApiSystemServiceConstants.API_REST_SYSTEM_USER_UPDATE_USER_PASSWORD), Integer.class, - Map.of("userId", id, "password", password == null ? "" : password)); - int updated = ent.getBody() == null ? 0 : ent.getBody(); - if (updated == 0) throw error(HttpStatus.BAD_REQUEST, "Password does not meet the password rules", "PASSWORD_RULES"); - return updated; - } - private Map load(Long id) { Map user = get(RestApiSystemServiceConstants.API_REST_SYSTEM_USER_FIND_BY_ID, id); if (user == null || !"A".equals(user.get("type"))) throw error(HttpStatus.NOT_FOUND, "User not found", "USER_NOT_FOUND"); @@ -179,6 +172,20 @@ public class AdminUserService { } } + /** A non-super admin may not change their own roles; hidden roles are not part of what they could change. */ + private static void requireOwnRolesUnchanged(User caller, Long id, Map stored, List requested) { + if (requested == null || isSuper(caller) || caller.getId() == null || !caller.getId().equals(id)) return; + Set current = new HashSet<>(); + if (stored.get("roles") instanceof List l) { + for (Object o : l) { + if (o instanceof Map m && m.get("id") instanceof Number n && !AdminRoleService.isHidden((Map) m)) current.add(n.longValue()); + } + } + Set wanted = new HashSet<>(); + requested.forEach(x -> wanted.add(x.id())); + if (!wanted.equals(current)) throw error(HttpStatus.FORBIDDEN, "You cannot change your own roles", "OWN_ROLES"); + } + private static CodedResponseStatusException superRequired(String reason) { return error(HttpStatus.FORBIDDEN, reason, "SUPER_ADMIN_REQUIRED"); } @@ -189,7 +196,7 @@ public class AdminUserService { List> out = new ArrayList<>(); for (AdminRoleRef ref : refs) { out.add((stored == null ? List.>of() : stored).stream() - .filter(m -> m.get("id") instanceof Number n && ref.id() != null && n.longValue() == ref.id()) + .filter(m -> m.get("id") instanceof Number n && ref.id() != null && n.longValue() == ref.id() && !AdminRoleService.isHidden(m)) .findFirst().orElseThrow(() -> error(HttpStatus.BAD_REQUEST, "Unknown role " + ref.id(), "UNKNOWN_ROLE"))); } return out; diff --git a/solvway-mobile-api/src/test/java/com/solvway/mobile/api/controller/admin/AdminRoleControllerTest.java b/solvway-mobile-api/src/test/java/com/solvway/mobile/api/controller/admin/AdminRoleControllerTest.java index b701687..58a06c0 100644 --- a/solvway-mobile-api/src/test/java/com/solvway/mobile/api/controller/admin/AdminRoleControllerTest.java +++ b/solvway-mobile-api/src/test/java/com/solvway/mobile/api/controller/admin/AdminRoleControllerTest.java @@ -129,9 +129,9 @@ class AdminRoleControllerTest { } @Test - void putModules_lockoutAnswers400() throws Exception { - when(acl.updateGrants(eq(4L), any())).thenThrow(new CodedResponseStatusException(HttpStatus.BAD_REQUEST, "lockout", "ACL_LOCKOUT")); + void putModules_ownRoleAnswers403() throws Exception { + when(acl.updateGrants(eq(4L), any())).thenThrow(new CodedResponseStatusException(HttpStatus.FORBIDDEN, "own role", "OWN_ROLE")); mvc.perform(put("/api/admin/roles/4/modules").contentType(MediaType.APPLICATION_JSON).content("{\"moduleIds\":[]}")) - .andExpect(status().isBadRequest()); + .andExpect(status().isForbidden()); } } diff --git a/solvway-mobile-api/src/test/java/com/solvway/mobile/api/controller/admin/AdminUserControllerTest.java b/solvway-mobile-api/src/test/java/com/solvway/mobile/api/controller/admin/AdminUserControllerTest.java index 976b6c0..c00c8d6 100644 --- a/solvway-mobile-api/src/test/java/com/solvway/mobile/api/controller/admin/AdminUserControllerTest.java +++ b/solvway-mobile-api/src/test/java/com/solvway/mobile/api/controller/admin/AdminUserControllerTest.java @@ -99,10 +99,10 @@ class AdminUserControllerTest { } @Test - void changePassword_returnsUpdated() throws Exception { - when(users.changePassword(5L, "Str0ng#Pass")).thenReturn(1); + void changePassword_endpointNoLongerExists() throws Exception { mvc.perform(post("/api/admin/users/5/changePassword").contentType(MediaType.APPLICATION_JSON) .content("{\"password\":\"Str0ng#Pass\"}")) - .andExpect(status().isOk()).andExpect(jsonPath("$.updated").value(1)); + .andExpect(status().is4xxClientError()); + org.mockito.Mockito.verifyNoInteractions(users); } } diff --git a/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/AdminAclServiceTest.java b/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/AdminAclServiceTest.java index ddca84a..6ad4b04 100644 --- a/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/AdminAclServiceTest.java +++ b/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/AdminAclServiceTest.java @@ -196,28 +196,23 @@ class AdminAclServiceTest { } @Test - void update_removingBoRolesFromTheCallersOnlyGrantingRoleIsALockout() { - caller(5, 2); // role 2 is attached to every admin and does not count - assertCoded(() -> service.updateGrants(5L, List.of()), HttpStatus.BAD_REQUEST, "ACL_LOCKOUT"); + void update_nonSuperCallerEditingARoleTheyHoldIsRefused() { + caller(5, 2); // role 2 is attached to every admin and is ignored + assertCoded(() -> service.updateGrants(5L, List.of()), HttpStatus.FORBIDDEN, "OWN_ROLE"); verifyNothingChanged(); } @Test - void update_removingBoRolesIsFineWhenAnotherCallerRoleStillGrantsIt() { - stubModules( - module(ROOT, "BO_ROOT", null, 1), - module(USERS, "BO_USERS", ROOT, 1, 4), - module(ROLES, "BO_ROLES", ROOT, 1, 5, 6)); + void update_ownRoleIsRefusedEvenWhenAnotherCallerRoleGrantsBoRoles() { caller(5, 6, 2); - service.updateGrants(5L, List.of()); - verify(rest).getForEntity(eq(DEL), eq(Integer.class), eq(ROLES), eq(5L)); + assertCoded(() -> service.updateGrants(5L, List.of()), HttpStatus.FORBIDDEN, "OWN_ROLE"); + verifyNothingChanged(); } @Test - void update_keepingBoRolesOnTheCallersRoleIsFine() { - service.updateGrants(5L, List.of(ROLES, USERS)); - verify(rest).getForEntity(eq(ADD), eq(Integer.class), eq(USERS), eq(5L)); - verify(rest, never()).getForEntity(eq(DEL), eq(Integer.class), any(), any()); + void update_ownRoleIsRefusedEvenWhenTheChangeKeepsBoRoles() { + assertCoded(() -> service.updateGrants(5L, List.of(ROLES, USERS)), HttpStatus.FORBIDDEN, "OWN_ROLE"); + verifyNothingChanged(); } @Test @@ -227,8 +222,8 @@ class AdminAclServiceTest { } @Test - void update_superAdminCallerIsNotSubjectToLockout() { - caller(1); + void update_superAdminCallerMayEditARoleTheyHold() { + caller(1, 5); service.updateGrants(5L, List.of()); verify(rest).getForEntity(eq(DEL), eq(Integer.class), eq(ROLES), eq(5L)); } diff --git a/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/AdminUserServiceTest.java b/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/AdminUserServiceTest.java index a5b0b86..6213e6a 100644 --- a/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/AdminUserServiceTest.java +++ b/solvway-mobile-api/src/test/java/com/solvway/mobile/api/service/AdminUserServiceTest.java @@ -43,7 +43,6 @@ class AdminUserServiceTest { private static final String BY_USERNAME = "/user/findByUsername/{username}"; private static final String BY_EMAIL = "/user/findByEmail/{email}"; private static final String BY_EMAIL_NOT = "/user/findByEmailAndIdNot/{email}/{id}"; - private static final String UPDATE_PWD = "/user/updateUserPassword"; private RestTemplateCustomUtil rest; private AdminAuthenticationService auth; @@ -497,9 +496,7 @@ class AdminUserServiceTest { assertCoded(() -> service.update(6L, new AdminUserRequest("X", null, null, null, null, null)), HttpStatus.FORBIDDEN, "SUPER_ADMIN_REQUIRED"); assertCoded(() -> service.resetPassword(6L), HttpStatus.FORBIDDEN, "SUPER_ADMIN_REQUIRED"); - assertCoded(() -> service.changePassword(6L, "Str0ng#Pass"), HttpStatus.FORBIDDEN, "SUPER_ADMIN_REQUIRED"); verify(rest, never()).postForEntity(eq(SAVE), any(ParameterizedTypeReference.class), any()); - verify(rest, never()).postForEntity(eq(UPDATE_PWD), eq(Integer.class), any()); verify(auth, never()).resetAdminPassword(anyString(), anyString()); } @@ -544,20 +541,81 @@ class AdminUserServiceTest { verify(auth).resetAdminPassword("stored", "stored@x.com"); } - @Test - void changePassword_rulesRejected_is400() { - stubFind(5, row(5, "A", "a", "a@x.com", true, "R")); - when(rest.postForEntity(eq(UPDATE_PWD), eq(Integer.class), any())).thenReturn(ResponseEntity.ok(0)); - assertCoded(() -> service.changePassword(5L, "weak"), HttpStatus.BAD_REQUEST, "PASSWORD_RULES"); + // ---- own roles and hidden roles ---- + + private static final List HIDDEN_ADMIN = List.of(new AdminRoleRef(2L, "ROLE_ADMIN")); + private static final List HIDDEN_MEMBER = List.of(new AdminRoleRef(3L, "ROLE_MEMBER")); + + private void storedRolesInclude(Map... extra) { + List> all = new ArrayList<>(List.of(fullRole(1, "ROLE_SUPER_ADMIN"), fullRole(4, "ROLE_SALES"), fullRole(5, "ROLE_OPS"))); + all.addAll(List.of(extra)); + when(rest.getForEntity(eq("/role/findAll"), any(ParameterizedTypeReference.class))).thenReturn(ResponseEntity.ok(all)); + } + + private Map ownRow() { + Map m = row(1, "Boss", "boss", "b@x.com", true); + m.put("roles", List.of(fullRole(2, "ROLE_ADMIN"), fullRole(4, "ROLE_SALES"))); + return m; } @Test - void changePassword_ok_returnsRowsUpdated() { + void update_nonSuperCallerCannotChangeTheirOwnRoles() { + storedRolesInclude(fullRole(2, "ROLE_ADMIN")); + stubNoDuplicates(); + stubFind(1, ownRow()); + assertCoded(() -> service.update(1L, new AdminUserRequest(null, null, null, null, null, List.of(new AdminRoleRef(5L, "ROLE_OPS")))), + HttpStatus.FORBIDDEN, "OWN_ROLES"); + verify(rest, never()).postForEntity(eq(SAVE), any(ParameterizedTypeReference.class), any()); + } + + @Test + void update_nonSuperCallerCannotAddARoleToThemself() { + storedRolesInclude(fullRole(2, "ROLE_ADMIN")); + stubNoDuplicates(); + stubFind(1, ownRow()); + assertCoded(() -> service.update(1L, new AdminUserRequest(null, null, null, null, null, + List.of(new AdminRoleRef(4L, "ROLE_SALES"), new AdminRoleRef(5L, "ROLE_OPS")))), HttpStatus.FORBIDDEN, "OWN_ROLES"); + verify(rest, never()).postForEntity(eq(SAVE), any(ParameterizedTypeReference.class), any()); + } + + @Test + void update_nonSuperCallerSavingTheirOwnSameRolesPasses() { + storedRolesInclude(fullRole(2, "ROLE_ADMIN")); + stubNoDuplicates(); + stubFind(1, ownRow()); + stubSave(ownRow()); + service.update(1L, new AdminUserRequest("Boss2", null, null, null, null, ROLES)); + verify(rest).postForEntity(eq(SAVE), any(ParameterizedTypeReference.class), any()); + } + + @Test + void update_nonSuperCallerSavingWithoutRolesPasses() { + stubNoDuplicates(); + stubFind(1, ownRow()); + stubSave(ownRow()); + service.update(1L, new AdminUserRequest("Boss2", null, null, null, null, null)); + verify(rest).postForEntity(eq(SAVE), any(ParameterizedTypeReference.class), any()); + } + + @Test + void update_superCallerMayChangeTheirOwnRoles() { + callerIsSuper(); + stubNoDuplicates(); + stubFind(1, ownRow()); + stubSave(ownRow()); + service.update(1L, new AdminUserRequest(null, null, null, null, null, List.of(new AdminRoleRef(5L, "ROLE_OPS")))); + verify(rest).postForEntity(eq(SAVE), any(ParameterizedTypeReference.class), any()); + } + + @Test + void createAndUpdate_hiddenRolesLookUnknown() { + storedRolesInclude(fullRole(2, "ROLE_ADMIN"), fullRole(3, "ROLE_MEMBER")); + stubNoDuplicates(); stubFind(5, row(5, "A", "a", "a@x.com", true, "R")); - when(rest.postForEntity(eq(UPDATE_PWD), eq(Integer.class), any())).thenReturn(ResponseEntity.ok(1)); - assertThat(service.changePassword(5L, "Str0ng#Pass")).isEqualTo(1); - ArgumentCaptor body = ArgumentCaptor.forClass(Object.class); - verify(rest).postForEntity(eq(UPDATE_PWD), eq(Integer.class), body.capture()); - assertThat((Map) body.getValue()).containsEntry("userId", 5L).containsEntry("password", "Str0ng#Pass"); + for (List hidden : List.of(HIDDEN_ADMIN, HIDDEN_MEMBER)) { + assertCoded(() -> service.create(req("N", "u", "e@x.com", hidden)), HttpStatus.BAD_REQUEST, "UNKNOWN_ROLE"); + assertCoded(() -> service.update(5L, new AdminUserRequest(null, null, null, null, null, hidden)), HttpStatus.BAD_REQUEST, "UNKNOWN_ROLE"); + } + verify(rest, never()).postForEntity(eq(SAVE), any(ParameterizedTypeReference.class), any()); } }