ConsentCleanupService
Name | ConsentCleanupService |
|---|---|
Class Path |
|
Versions | 10 11 |
Implements:
io.trustbuilder.andromeda.util.PublicBean
Overview
The ConsentCleanupService provides maintenance operations for the CONSENT data, including removing expired and unlinked consents, optimizing table statistics, and bulk-removing consents based on filtering criteria.
Available Functions
cleanExpiredConsents(): int
This method cleans consents which are expired.
Returns:
int: number of deleted consents.
cleanUnlinkedConsents(Long batchSize): long
This method checks OAuth tokens and finds the linked consent IDs, then removes unlinked consents (not used by any OAuth token) in iterations until there is no unlinked consent.
Parameters:
batchSize(long): Max size of consents deleted in each iteration.
Returns:
long: number of deleted consents.
optimizeConsentTable(): void
Requests the SQL server to analyze and update CONSENT table statistics and reclaims empty space.
Returns:
void
removeConsents(Long createdAfterMilliseconds, Long createdBeforeMilliseconds, boolean includeClientSPs, boolean excludeClientSPs, List<Integer> spIds, boolean includeAuthenticationMethods, boolean excludeAuthenticationMethods, List<Integer> authenticationMethodIds, long batchSize, Long limit): long
Deletes rows in the CONSENT table with respect to the given parameters. Only createdAfterMilliseconds, createdBeforeMilliseconds, and limit can be null.
Parameters:
createdAfterMilliseconds(Long): EPOCH time in milliseconds (JS compatible) where consents created after this time will be deleted. If null, begins from EPOCH.createdBeforeMilliseconds(Long): EPOCH time in milliseconds (JS compatible) where consents created before this time will be deleted. If null, uses NOW.includeClientSPs(boolean): Deletes consents having SP IDs given inspIdsif true.excludeClientSPs(boolean): Deletes consents having SP IDs NOT given inspIdsif true.spIds(List<Integer>): ID list of SPs where the consents will be deleted. IfincludeClientSPsandexcludeClientSPsare both true or both false,spIdswill not be used as a condition.includeAuthenticationMethods(boolean): Deletes consents having Authentication Method IDs given in this parameter if true.excludeAuthenticationMethods(boolean): Deletes consents having Authentication Method IDs NOT given in this parameter if true.authenticationMethodIds(List<Integer>): ID list of Authentication Methods where the consents will be deleted. IfincludeAuthenticationMethodsandexcludeAuthenticationMethodsare both true or both false thenauthenticationMethodIdswill not be used as a condition since inclusion or exclusion cannot be determined.batchSize(long): Max number of consents to be deleted in each iteration.limit(Long): Max total number of consents to be deleted. If null, usesLong.MAX_VALUE.
Returns:
long: number of deleted consents.
Summary
The ConsentCleanupService supports:
Cleaning expired consents.
Removing unlinked consents (with optional batch size control).
Optimizing the CONSENT table for statistics and storage.
Bulk removal of consents using time windows, SP filters, authentication method filters, and batching/limits.