From 97b9129e9423b199ba380d1993b8400daf23c068 Mon Sep 17 00:00:00 2001 From: sadilchamishka Date: Fri, 5 Sep 2025 14:22:04 +0530 Subject: [PATCH] Handle request object data clean if internal token clean up is enabled --- .../wso2/carbon/identity/oauth2/dao/AccessTokenDAOImpl.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/dao/AccessTokenDAOImpl.java b/components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/dao/AccessTokenDAOImpl.java index ab4f4b29b8f..53cbac4e8a6 100644 --- a/components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/dao/AccessTokenDAOImpl.java +++ b/components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/dao/AccessTokenDAOImpl.java @@ -2126,7 +2126,6 @@ public void invalidateAndCreateNewAccessToken(String oldAccessTokenId, String to + Arrays.toString(accessTokenDO.getScope())); } } - boolean tokenUpdateSuccessful; Connection connection = IdentityDatabaseUtil.getDBConnection(true); try { if (OAuth2ServiceComponentHolder.isConsentedTokenColumnEnabled() && !accessTokenDO.isConsentedToken()) { @@ -2149,7 +2148,6 @@ public void invalidateAndCreateNewAccessToken(String oldAccessTokenId, String to oldTokenCleanupObject.cleanupTokenByTokenId(oldAccessTokenId, connection); } IdentityDatabaseUtil.commitTransaction(connection); - tokenUpdateSuccessful = true; } catch (SQLException e) { IdentityDatabaseUtil.rollbackTransaction(connection); String errorMsg = "Error while regenerating access token"; @@ -2157,7 +2155,7 @@ public void invalidateAndCreateNewAccessToken(String oldAccessTokenId, String to } finally { IdentityDatabaseUtil.closeConnection(connection); } - if (tokenUpdateSuccessful) { + if (isTokenCleanupFeatureEnabled) { // Post refresh access token event if (StringUtils.equals(grantType, OAuthConstants.GrantTypes.CLIENT_CREDENTIALS) || StringUtils.equals(grantType, OAuthConstants.GrantTypes.PASSWORD)) {