| 1 | package edu.ucsb.cs156.example.controllers; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.example.models.CurrentUser; | |
| 4 | ||
| 5 | import io.swagger.v3.oas.annotations.Operation; | |
| 6 | import io.swagger.v3.oas.annotations.tags.Tag; | |
| 7 | ||
| 8 | import org.springframework.security.access.prepost.PreAuthorize; | |
| 9 | import org.springframework.web.bind.annotation.GetMapping; | |
| 10 | import org.springframework.web.bind.annotation.RequestMapping; | |
| 11 | import org.springframework.web.bind.annotation.RestController; | |
| 12 | ||
| 13 | /** | |
| 14 | * This is a REST controller for getting information about the current user. | |
| 15 | */ | |
| 16 | ||
| 17 | @Tag(name="Current User Information") | |
| 18 | @RequestMapping("/api/currentUser") | |
| 19 | @RestController | |
| 20 | public class UserInfoController extends ApiController { | |
| 21 | | |
| 22 | /** | |
| 23 | * This method returns the current user. | |
| 24 | * @return the current user | |
| 25 | */ | |
| 26 | ||
| 27 | @Operation(summary= "Get information about current user") | |
| 28 | @PreAuthorize("hasRole('ROLE_USER')") | |
| 29 | @GetMapping("") | |
| 30 | public CurrentUser getCurrentUser() { | |
| 31 |
1
1. getCurrentUser : replaced return value with null for edu/ucsb/cs156/example/controllers/UserInfoController::getCurrentUser → KILLED |
return super.getCurrentUser(); |
| 32 | } | |
| 33 | } | |
Mutations | ||
| 31 |
1.1 |