Fix potential bug in concurrent token refresh support (#53668) (#53705)

Ensure that we do not proceed execution after calling the
listerer's onFailure
This commit is contained in:
Ioannis Kakavas 2020-03-18 09:43:26 +02:00 committed by GitHub
parent 7a12300ce6
commit 873d0ecd09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -1071,9 +1071,10 @@ public final class TokenService {
if (decryptedTokens.length != 2) { if (decryptedTokens.length != 2) {
logger.warn("Decrypted tokens string is not correctly formatted"); logger.warn("Decrypted tokens string is not correctly formatted");
listener.onFailure(invalidGrantException("could not refresh the requested token")); listener.onFailure(invalidGrantException("could not refresh the requested token"));
} else {
listener.onResponse(new Tuple<>(prependVersionAndEncodeAccessToken(refreshTokenStatus.getVersion(), decryptedTokens[0]),
prependVersionAndEncodeRefreshToken(refreshTokenStatus.getVersion(), decryptedTokens[1])));
} }
listener.onResponse(new Tuple<>(prependVersionAndEncodeAccessToken(refreshTokenStatus.getVersion(), decryptedTokens[0]),
prependVersionAndEncodeRefreshToken(refreshTokenStatus.getVersion(), decryptedTokens[1])));
} catch (GeneralSecurityException | IOException e) { } catch (GeneralSecurityException | IOException e) {
logger.warn("Could not get stored superseding token values", e); logger.warn("Could not get stored superseding token values", e);
listener.onFailure(invalidGrantException("could not refresh the requested token")); listener.onFailure(invalidGrantException("could not refresh the requested token"));