IdpController extends SharedController { @PutMapping("/users") public void addUser(@RequestBody User user) { LOG.info("Request to add user {}", user); FederatedUserAuthenticationToken userAuthenticationToken = new FederatedUserAuthenticationToken( user.getName(), user.getPassword(), user.getAuthorities().stream().map(SimpleGrantedAuthority::new).collect(toList())); userAuthenticationToken.getAttributes().putAll(configuration().getAttributes()); configuration().getUsers().add(userAuthenticationToken); } @Autowired  IdpController(IdpConfiguration configuration); @PutMapping("/attributes") void setAttributes(@RequestBody Map<String, List<String>> attributes); @PutMapping("/attributes/{name:.+}") void setAttribute(@PathVariable String name, @RequestBody List<String> values); @PutMapping("/attributes/{name:.+}/{userName:.+}") void setAttributeForUser(@PathVariable String name, @PathVariable String userName,
                                  @RequestBody List<String> values); @DeleteMapping("/attributes/{name:.+}") void removeAttribute(@PathVariable String name); @DeleteMapping("/attributes/{name:.+}/{userName:.+}") void removeAttributeForUser(@PathVariable String name, @PathVariable String userName); @PutMapping("/users") void addUser(@RequestBody User user); @PutMapping("authmethod") void setAuthenticationMethod(@RequestBody String authenticationMethod); @PutMapping("/acsendpoint") void setAcsEndpoint(@RequestBody String acsEndpoint);  }
@Test public void addUser() { User user = new User("Bob", "secret", Arrays.asList("USER", "ADMIN")); api(user, "/api/users"); assertTrue(idpConfiguration.getUsers().stream() .filter(token -> token.getName().equals(user.getName())).findAny().isPresent()); }