Changeset 62b653f for springapp/src/main/java/mk/profesori/springapp/Controller/SecureController.java
- Timestamp:
- 08/30/22 15:33:18 (22 months ago)
- Branches:
- main
- Children:
- cae16b5
- Parents:
- 2fcbde4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
springapp/src/main/java/mk/profesori/springapp/Controller/SecureController.java
r2fcbde4 r62b653f 25 25 @RestController 26 26 @RequestMapping("/secure") 27 @CrossOrigin(origins = { "http://192.168.0.1 9:3000", "http://192.168.0.24:3000" })27 @CrossOrigin(origins = { "http://192.168.0.17:3000", "http://192.168.0.24:3000" }) 28 28 public class SecureController { 29 29 … … 72 72 } 73 73 74 @RequestMapping(value = "/professor/{professorId}/upvoteOpinion/{postId}", method = RequestMethod.GET) 75 public void upvoteOpinion(@PathVariable Long professorId, 76 @PathVariable Long postId, @CurrentSecurityContext SecurityContext context) { 77 78 Authentication authentication = context.getAuthentication(); 79 80 if (authentication != null && authentication.getPrincipal() instanceof CustomUserDetails) { 81 CustomUserDetails currentUser = (CustomUserDetails) authentication.getPrincipal(); 82 mainService.upvoteOpinion(postId, currentUser); 83 } 84 } 85 86 @RequestMapping(value = "/professor/{professorId}/downvoteOpinion/{postId}", method = RequestMethod.GET) 87 public void downvoteOpinion(@PathVariable Long professorId, 88 @PathVariable Long postId, @CurrentSecurityContext SecurityContext context) { 89 90 Authentication authentication = context.getAuthentication(); 91 92 if (authentication != null && authentication.getPrincipal() instanceof CustomUserDetails) { 93 CustomUserDetails currentUser = (CustomUserDetails) authentication.getPrincipal(); 94 mainService.downvoteOpinion(postId, currentUser); 95 } 96 } 97 74 98 }
Note:
See TracChangeset
for help on using the changeset viewer.