I want my resource to be like this. Same method mapping but each will be called based on the authority of who sent the request. Any solution for this?
@RestController
@RequestMapping("/test")
public class TestResource {
@GetMapping
@PreAuthorize("hasAuthority('COMMITTEE')")
public String testForCommittee() {
return "This is a test. Custom result for committee.";
}
@GetMapping
@PreAuthorize("hasAuthority('ADMIN')")
public String testForAdmin() {
return "This is a test. Custom result for admin.";
}
}