Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Added notification for device code removal #3979

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,12 @@ public interface IOperationalStoreNotification
/// <param name="persistedGrants"></param>
/// <returns></returns>
Task PersistedGrantsRemovedAsync(IEnumerable<PersistedGrant> persistedGrants);

/// <summary>
/// Notification for device codes being removed.
/// </summary>
/// <param name="deviceCodes"></param>
/// <returns></returns>
Task DeviceCodesRemovedAsync(IEnumerable<DeviceFlowCodes> deviceCodes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ protected virtual async Task RemoveDeviceCodesAsync()
try
{
await _persistedGrantDbContext.SaveChangesAsync();

if (_operationalStoreNotification != null)
{
await _operationalStoreNotification.DeviceCodesRemovedAsync(expiredCodes);
}
}
catch (DbUpdateConcurrencyException ex)
{
Expand Down
9 changes: 9 additions & 0 deletions src/EntityFramework/host/TestOperationalStoreNotification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,14 @@ public Task PersistedGrantsRemovedAsync(IEnumerable<PersistedGrant> persistedGra
}
return Task.CompletedTask;
}

public Task DeviceCodesRemovedAsync(IEnumerable<DeviceFlowCodes> deviceCodes)
{
foreach (var deviceCode in deviceCodes)
{
Console.WriteLine("cleaned device code");
}
return Task.CompletedTask;
}
}
}