Fix Java 11 issue where the order of methods returned in AssignmentEndpoint subclasses returned wrong method for determining the mapping of an assignment. Now we walk over all methods until we find one which has for example a @GetMapping with AttackResult or ResponseEntity<AttackResult as return type. If no such method is found an exception is thrown

This commit is contained in:
Nanne Baars
2020-04-18 21:03:58 +02:00
committed by Nanne Baars
parent 96412da04e
commit 4f649234a9
2 changed files with 20 additions and 10 deletions

View File

@ -26,6 +26,7 @@ import io.jsonwebtoken.*;
import org.apache.commons.lang3.RandomStringUtils;
import org.owasp.webgoat.assignments.AssignmentEndpoint;
import org.owasp.webgoat.assignments.AssignmentHints;
import org.owasp.webgoat.assignments.AttackResult;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@ -82,7 +83,7 @@ public class JWTRefreshEndpoint extends AssignmentEndpoint {
@PostMapping("/JWT/refresh/checkout")
@ResponseBody
public ResponseEntity<?> checkout(@RequestHeader(value = "Authorization", required = false) String token) {
public ResponseEntity<AttackResult> checkout(@RequestHeader(value = "Authorization", required = false) String token) {
if (token == null) {
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
}