Skip to content

Commit 1960646

Browse files
authored
prevent concurrent token read / refresh (openhab#4686)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
1 parent 0f354e6 commit 1960646

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/OAuthClientServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ public AccessTokenResponse getAccessTokenByClientCredentials(@Nullable String sc
291291
}
292292

293293
@Override
294-
public AccessTokenResponse refreshToken() throws OAuthException, IOException, OAuthResponseException {
294+
public synchronized AccessTokenResponse refreshToken() throws OAuthException, IOException, OAuthResponseException {
295295
if (isClosed()) {
296296
throw new OAuthException(EXCEPTION_MESSAGE_CLOSED);
297297
}
@@ -333,7 +333,7 @@ public AccessTokenResponse refreshToken() throws OAuthException, IOException, OA
333333
}
334334

335335
@Override
336-
public @Nullable AccessTokenResponse getAccessTokenResponse()
336+
public synchronized @Nullable AccessTokenResponse getAccessTokenResponse()
337337
throws OAuthException, IOException, OAuthResponseException {
338338
if (isClosed()) {
339339
throw new OAuthException(EXCEPTION_MESSAGE_CLOSED);

0 commit comments

Comments
 (0)