SUPPORT-8593: Fix
This commit is contained in:
parent
85124d60ff
commit
fd6507217b
2 changed files with 15 additions and 12 deletions
|
|
@ -38,8 +38,10 @@ public class EsiaController {
|
|||
return esiaAuthService.generateAuthCodeUrl();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/esia/auth", params = "code")
|
||||
public ResponseEntity<?> esiaAuth(@RequestParam("code") String code, @RequestParam("error") String error, HttpServletRequest request, HttpServletResponse response) {
|
||||
@GetMapping(value = "/esia/auth")
|
||||
public ResponseEntity<?> esiaAuth(@RequestParam(value = "code", required = false) String code,
|
||||
@RequestParam(value = "error", required = false) String error, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
return esiaAuthService.getEsiaTokensByCode(code, error, request, response);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -436,16 +436,17 @@ public ResponseEntity<?> getEsiaTokensByCode(String esiaAuthCode, String error,
|
|||
if (!esiaAccessToken.getIss().equals(esiaConfig.getEsiaIssuerUrl())) {
|
||||
return "Token invalid. Token issuer:" + esiaAccessToken.getIss() + " invalid";
|
||||
}
|
||||
LocalDateTime iatTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(esiaAccessToken.getIat()),
|
||||
ZoneId.systemDefault()
|
||||
);
|
||||
LocalDateTime expTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(esiaAccessToken.getExp()),
|
||||
ZoneId.systemDefault()
|
||||
);
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
if (!currentTime.isAfter(iatTime) || !expTime.isAfter(iatTime)) {
|
||||
return "Token invalid. Token expired";
|
||||
}
|
||||
//TODO SUPPORT-8750
|
||||
// LocalDateTime iatTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(esiaAccessToken.getIat()),
|
||||
// ZoneId.systemDefault()
|
||||
// );
|
||||
// LocalDateTime expTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(esiaAccessToken.getExp()),
|
||||
// ZoneId.systemDefault()
|
||||
// );
|
||||
// LocalDateTime currentTime = LocalDateTime.now();
|
||||
// if (!currentTime.isAfter(iatTime) || !expTime.isAfter(iatTime)) {
|
||||
// return "Token invalid. Token expired";
|
||||
// }
|
||||
HttpResponse<String> response = signVerify(accessToken);
|
||||
if (response.statusCode() != 200) {
|
||||
if (response.statusCode() == 401) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue