diff --git a/src/EntityFramework.Storage/src/TokenCleanup/IOperationalStoreNotification.cs b/src/EntityFramework.Storage/src/TokenCleanup/IOperationalStoreNotification.cs index 15bb4a5d7b..cbe4af3319 100644 --- a/src/EntityFramework.Storage/src/TokenCleanup/IOperationalStoreNotification.cs +++ b/src/EntityFramework.Storage/src/TokenCleanup/IOperationalStoreNotification.cs @@ -19,5 +19,12 @@ public interface IOperationalStoreNotification /// /// Task PersistedGrantsRemovedAsync(IEnumerable persistedGrants); + + /// + /// Notification for device codes being removed. + /// + /// + /// + Task DeviceCodesRemovedAsync(IEnumerable deviceCodes); } } \ No newline at end of file diff --git a/src/EntityFramework.Storage/src/TokenCleanup/TokenCleanupService.cs b/src/EntityFramework.Storage/src/TokenCleanup/TokenCleanupService.cs index 7f990d5fd2..7e49391365 100644 --- a/src/EntityFramework.Storage/src/TokenCleanup/TokenCleanupService.cs +++ b/src/EntityFramework.Storage/src/TokenCleanup/TokenCleanupService.cs @@ -130,6 +130,11 @@ protected virtual async Task RemoveDeviceCodesAsync() try { await _persistedGrantDbContext.SaveChangesAsync(); + + if (_operationalStoreNotification != null) + { + await _operationalStoreNotification.DeviceCodesRemovedAsync(expiredCodes); + } } catch (DbUpdateConcurrencyException ex) { diff --git a/src/EntityFramework/host/TestOperationalStoreNotification.cs b/src/EntityFramework/host/TestOperationalStoreNotification.cs index 14b23cc770..37271e074b 100644 --- a/src/EntityFramework/host/TestOperationalStoreNotification.cs +++ b/src/EntityFramework/host/TestOperationalStoreNotification.cs @@ -21,5 +21,14 @@ public Task PersistedGrantsRemovedAsync(IEnumerable persistedGra } return Task.CompletedTask; } + + public Task DeviceCodesRemovedAsync(IEnumerable deviceCodes) + { + foreach (var deviceCode in deviceCodes) + { + Console.WriteLine("cleaned device code"); + } + return Task.CompletedTask; + } } }