fix: Conversion logic for expires in field (#12781)

This commit is contained in:
Nidhi 2022-04-11 16:57:24 +05:30 committed by GitHub
parent 6e63290477
commit e36b352a42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -142,9 +142,9 @@ public class OAuth2AuthorizationCode extends APIConnection implements UpdatableC
Object expiresInResponse = mappedResponse.get(Authentication.EXPIRES_IN);
Instant expiresAt = null;
if (expiresAtResponse != null) {
expiresAt = Instant.ofEpochSecond(Long.valueOf((Integer) expiresAtResponse));
expiresAt = Instant.ofEpochSecond(Long.parseLong(String.valueOf(expiresAtResponse)));
} else if (expiresInResponse != null) {
expiresAt = issuedAt.plusSeconds(Long.valueOf((Integer) expiresInResponse));
expiresAt = issuedAt.plusSeconds(Long.parseLong(String.valueOf(expiresInResponse)));
}
authenticationResponse.setExpiresAt(expiresAt);
authenticationResponse.setIssuedAt(issuedAt);

View File

@ -111,9 +111,9 @@ public class OAuth2ClientCredentials extends APIConnection implements UpdatableC
Object expiresInResponse = mappedResponse.get(Authentication.EXPIRES_IN);
Instant expiresAt = null;
if (expiresAtResponse != null) {
expiresAt = Instant.ofEpochSecond(Long.parseLong((String) expiresAtResponse));
expiresAt = Instant.ofEpochSecond(Long.parseLong(String.valueOf(expiresAtResponse)));
} else if (expiresInResponse != null) {
expiresAt = issuedAt.plusSeconds(Long.valueOf((Integer) expiresInResponse));
expiresAt = issuedAt.plusSeconds(Long.parseLong(String.valueOf(expiresInResponse)));
}
authenticationResponse.setExpiresAt(expiresAt);
authenticationResponse.setIssuedAt(issuedAt);

View File

@ -230,9 +230,9 @@ public class AuthenticationServiceCEImpl implements AuthenticationServiceCE {
Object expiresInResponse = response.get(Authentication.EXPIRES_IN);
Instant expiresAt = null;
if (expiresAtResponse != null) {
expiresAt = Instant.ofEpochSecond(Long.valueOf((Integer) expiresAtResponse));
expiresAt = Instant.ofEpochSecond(Long.parseLong(String.valueOf(expiresAtResponse)));
} else if (expiresInResponse != null) {
expiresAt = issuedAt.plusSeconds(Long.parseLong((String) expiresInResponse));
expiresAt = issuedAt.plusSeconds(Long.parseLong(String.valueOf(expiresInResponse)));
}
authenticationResponse.setExpiresAt(expiresAt);
// Replacing with returned scope instead