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

Commit

Permalink
Added notification for device code removal (#3979)
Browse files Browse the repository at this point in the history
* Added notification for device code removal

* Updated TestOperationalStoreNotification
  • Loading branch information
scottbrady91 committed Mar 24, 2020
1 parent c004ae4 commit ee3a557
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
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;
}
}
}

0 comments on commit ee3a557

Please sign in to comment.