78.3 List all users (#9)

This commit is contained in:
Art
2021-09-09 23:02:43 +03:00
parent 0eedcf8269
commit e400f04a24
2 changed files with 28 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static org.springframework.http.HttpStatus.OK;
@ -74,6 +75,11 @@ public class UserResource {
return userService.findByUsername(username);
}
@GetMapping
public List<User> getAllUsers() {
return userService.findAll();
}
private void authenticate(String username, String password) {
Authentication auth = new UsernamePasswordAuthenticationToken(username, password);
authenticationManager.authenticate(auth);