BAEL-3972: Fix formatting

This commit is contained in:
Michael Pratt 2020-04-25 11:37:01 -06:00
parent 64e47e7f77
commit bd9c4945f7

View File

@ -48,8 +48,7 @@ public class TaskController {
*/ */
@GetMapping("/manager") @GetMapping("/manager")
@PreAuthorize("hasRole('ROLE_MANAGER')") @PreAuthorize("hasRole('ROLE_MANAGER')")
public ResponseEntity<Iterable<Task>> getAlManagerTasks() public ResponseEntity<Iterable<Task>> getAlManagerTasks() {
{
Iterable<Task> tasks = taskService.findAll(); Iterable<Task> tasks = taskService.findAll();
return ResponseEntity.ok().body(tasks); return ResponseEntity.ok().body(tasks);
@ -59,8 +58,7 @@ public class TaskController {
* Example of restricting specific endpoints to specific roles using SecurityContext. * Example of restricting specific endpoints to specific roles using SecurityContext.
*/ */
@GetMapping("/actuator") @GetMapping("/actuator")
public ResponseEntity<Iterable<Task>> getAlActuatorTasks() public ResponseEntity<Iterable<Task>> getAlActuatorTasks() {
{
Authentication auth = SecurityContextHolder.getContext().getAuthentication(); Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null && auth.getAuthorities().stream().anyMatch(a -> a.getAuthority().equals("ACTUATOR"))) if (auth != null && auth.getAuthorities().stream().anyMatch(a -> a.getAuthority().equals("ACTUATOR")))
{ {
@ -76,8 +74,7 @@ public class TaskController {
* Example of restricting specific endpoints to specific roles using UserDetailsService. * Example of restricting specific endpoints to specific roles using UserDetailsService.
*/ */
@GetMapping("/admin") @GetMapping("/admin")
public ResponseEntity<Iterable<Task>> getAlAdminTasks() public ResponseEntity<Iterable<Task>> getAlAdminTasks() {
{
if(userDetailsService != null) { if(userDetailsService != null) {
UserDetails details = userDetailsService.loadUserByUsername("pam"); UserDetails details = userDetailsService.loadUserByUsername("pam");
if (details != null && details.getAuthorities().stream().anyMatch(a -> a.getAuthority().equals("ADMIN"))) { if (details != null && details.getAuthorities().stream().anyMatch(a -> a.getAuthority().equals("ADMIN"))) {
@ -94,8 +91,7 @@ public class TaskController {
* Example of restricting specific endpoints to specific roles using HttpServletRequest. * Example of restricting specific endpoints to specific roles using HttpServletRequest.
*/ */
@GetMapping("/admin2") @GetMapping("/admin2")
public ResponseEntity<Iterable<Task>> getAlAdminTasksUsingServlet(HttpServletRequest request) public ResponseEntity<Iterable<Task>> getAlAdminTasksUsingServlet(HttpServletRequest request) {
{
if (!request.isUserInRole("ROLE_ADMIN")) { if (!request.isUserInRole("ROLE_ADMIN")) {
return ResponseEntity.status(HttpStatus.FORBIDDEN).build(); return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
} }