Skip to content

Commit 3980f4a

Browse files
authored
Merge pull request #915 from aka4rKO/main-remove-consent-data
[OB4] Removing session data key consent from the cache
2 parents d08c5ec + adc5c88 commit 3980f4a

File tree

2 files changed

+16
-0
lines changed
  • financial-services-accelerator/internal-webapps/org.wso2.financial.services.accelerator.consent.mgt.endpoint/src/main/java/org/wso2/financial/services/accelerator/consent/mgt/endpoint

2 files changed

+16
-0
lines changed

financial-services-accelerator/internal-webapps/org.wso2.financial.services.accelerator.consent.mgt.endpoint/src/main/java/org/wso2/financial/services/accelerator/consent/mgt/endpoint/api/ConsentAuthorizeEndpoint.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ public Response persist(@Context HttpServletRequest request, @Context HttpServle
256256
throws ConsentException, ConsentManagementException, URISyntaxException {
257257

258258
ConsentData consentData = ConsentCache.getConsentDataFromCache(sessionDataKey);
259+
260+
/*
261+
Remove consent data from the cache to prevent multiple calls to the persist endpoint.
262+
This ensures the flow is completed and avoids further updates after a single persistence.
263+
*/
264+
ConsentCache.removeFromCache(sessionDataKey);
265+
259266
URI location;
260267
try {
261268
if (consentData == null) {

financial-services-accelerator/internal-webapps/org.wso2.financial.services.accelerator.consent.mgt.endpoint/src/main/java/org/wso2/financial/services/accelerator/consent/mgt/endpoint/utils/ConsentCache.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,13 @@ public int setModifiedExpiryMinutes() {
223223

224224
return FinancialServicesConfigParser.getInstance().getCommonCacheModifiedExpiryTime();
225225
}
226+
227+
/**
228+
* Remove from the consent cache
229+
* @param cacheKey Cache key
230+
*/
231+
public static void removeFromCache(String cacheKey) {
232+
233+
ConsentCache.getInstance().removeFromCache(ConsentCacheKey.of(cacheKey));
234+
}
226235
}

0 commit comments

Comments
 (0)