diff --git a/src/Core/Services/IPushNotificationService.cs b/src/Core/Services/IPushNotificationService.cs index 0efddb4cac..eec8a2628e 100644 --- a/src/Core/Services/IPushNotificationService.cs +++ b/src/Core/Services/IPushNotificationService.cs @@ -15,7 +15,7 @@ public interface IPushNotificationService Task PushSyncVaultAsync(Guid userId); Task PushSyncOrgKeysAsync(Guid userId); Task PushSyncSettingsAsync(Guid userId); - Task PushLogOutAsync(Guid userId); + Task PushLogOutAsync(Guid userId, bool excludeCurrentContextFromPush = false); Task PushSyncSendCreateAsync(Send send); Task PushSyncSendUpdateAsync(Send send); Task PushSyncSendDeleteAsync(Send send); diff --git a/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs b/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs index ab5bdfbe5d..6849bfbbf5 100644 --- a/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs +++ b/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs @@ -114,12 +114,12 @@ public class AzureQueuePushNotificationService : IPushNotificationService await PushUserAsync(userId, PushType.SyncSettings); } - public async Task PushLogOutAsync(Guid userId) + public async Task PushLogOutAsync(Guid userId, bool excludeCurrentContext = false) { - await PushUserAsync(userId, PushType.LogOut); + await PushUserAsync(userId, PushType.LogOut, excludeCurrentContext); } - private async Task PushUserAsync(Guid userId, PushType type) + private async Task PushUserAsync(Guid userId, PushType type, bool excludeCurrentContext = false) { var message = new UserPushNotification { @@ -127,7 +127,7 @@ public class AzureQueuePushNotificationService : IPushNotificationService Date = DateTime.UtcNow }; - await SendMessageAsync(type, message, false); + await SendMessageAsync(type, message, excludeCurrentContext); } public async Task PushAuthRequestAsync(AuthRequest authRequest) diff --git a/src/Core/Services/Implementations/MultiServicePushNotificationService.cs b/src/Core/Services/Implementations/MultiServicePushNotificationService.cs index b0b9f8ff58..1a64829cce 100644 --- a/src/Core/Services/Implementations/MultiServicePushNotificationService.cs +++ b/src/Core/Services/Implementations/MultiServicePushNotificationService.cs @@ -115,9 +115,9 @@ public class MultiServicePushNotificationService : IPushNotificationService return Task.FromResult(0); } - public Task PushLogOutAsync(Guid userId) + public Task PushLogOutAsync(Guid userId, bool excludeCurrentContext = false) { - PushToServices((s) => s.PushLogOutAsync(userId)); + PushToServices((s) => s.PushLogOutAsync(userId, excludeCurrentContext)); return Task.FromResult(0); } diff --git a/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs b/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs index bbd6cfc35f..e52c99878f 100644 --- a/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs +++ b/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs @@ -125,12 +125,12 @@ public class NotificationHubPushNotificationService : IPushNotificationService await PushUserAsync(userId, PushType.SyncSettings); } - public async Task PushLogOutAsync(Guid userId) + public async Task PushLogOutAsync(Guid userId, bool excludeCurrentContext = false) { - await PushUserAsync(userId, PushType.LogOut); + await PushUserAsync(userId, PushType.LogOut, excludeCurrentContext); } - private async Task PushUserAsync(Guid userId, PushType type) + private async Task PushUserAsync(Guid userId, PushType type, bool excludeCurrentContext = false) { var message = new UserPushNotification { @@ -138,7 +138,7 @@ public class NotificationHubPushNotificationService : IPushNotificationService Date = DateTime.UtcNow }; - await SendPayloadToUserAsync(userId, type, message, false); + await SendPayloadToUserAsync(userId, type, message, excludeCurrentContext); } public async Task PushSyncSendCreateAsync(Send send) diff --git a/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs b/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs index bff7f392f5..1242744964 100644 --- a/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs +++ b/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs @@ -121,12 +121,12 @@ public class NotificationsApiPushNotificationService : BaseIdentityClientService await PushUserAsync(userId, PushType.SyncSettings); } - public async Task PushLogOutAsync(Guid userId) + public async Task PushLogOutAsync(Guid userId, bool excludeCurrentContext) { - await PushUserAsync(userId, PushType.LogOut); + await PushUserAsync(userId, PushType.LogOut, excludeCurrentContext); } - private async Task PushUserAsync(Guid userId, PushType type) + private async Task PushUserAsync(Guid userId, PushType type, bool excludeCurrentContext = false) { var message = new UserPushNotification { @@ -134,7 +134,7 @@ public class NotificationsApiPushNotificationService : BaseIdentityClientService Date = DateTime.UtcNow }; - await SendMessageAsync(type, message, false); + await SendMessageAsync(type, message, excludeCurrentContext); } public async Task PushAuthRequestAsync(AuthRequest authRequest) diff --git a/src/Core/Services/Implementations/RelayPushNotificationService.cs b/src/Core/Services/Implementations/RelayPushNotificationService.cs index 573102ac91..17dae87099 100644 --- a/src/Core/Services/Implementations/RelayPushNotificationService.cs +++ b/src/Core/Services/Implementations/RelayPushNotificationService.cs @@ -121,12 +121,12 @@ public class RelayPushNotificationService : BaseIdentityClientService, IPushNoti await PushUserAsync(userId, PushType.SyncSettings); } - public async Task PushLogOutAsync(Guid userId) + public async Task PushLogOutAsync(Guid userId, bool excludeCurrentContext = false) { - await PushUserAsync(userId, PushType.LogOut); + await PushUserAsync(userId, PushType.LogOut, excludeCurrentContext); } - private async Task PushUserAsync(Guid userId, PushType type) + private async Task PushUserAsync(Guid userId, PushType type, bool excludeCurrentContext = false) { var message = new UserPushNotification { @@ -134,7 +134,7 @@ public class RelayPushNotificationService : BaseIdentityClientService, IPushNoti Date = DateTime.UtcNow }; - await SendPayloadToUserAsync(userId, type, message, false); + await SendPayloadToUserAsync(userId, type, message, excludeCurrentContext); } public async Task PushSyncSendCreateAsync(Send send) diff --git a/src/Core/Services/Implementations/UserService.cs b/src/Core/Services/Implementations/UserService.cs index 46509ceda4..68152a9569 100644 --- a/src/Core/Services/Implementations/UserService.cs +++ b/src/Core/Services/Implementations/UserService.cs @@ -618,7 +618,7 @@ public class UserService : UserManager, IUserService, IDisposable await _userRepository.ReplaceAsync(user); await _eventService.LogUserEventAsync(user.Id, EventType.User_ChangedPassword); - await _pushService.PushLogOutAsync(user.Id); + await _pushService.PushLogOutAsync(user.Id, true); return IdentityResult.Success; } diff --git a/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs b/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs index a99ef96fb8..efc445f694 100644 --- a/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs +++ b/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs @@ -55,7 +55,7 @@ public class NoopPushNotificationService : IPushNotificationService return Task.FromResult(0); } - public Task PushLogOutAsync(Guid userId) + public Task PushLogOutAsync(Guid userId, bool excludeCurrentContext = false) { return Task.FromResult(0); } diff --git a/src/Notifications/Properties/launchSettings.json b/src/Notifications/Properties/launchSettings.json index d3b375a36b..e1ac5a613f 100644 --- a/src/Notifications/Properties/launchSettings.json +++ b/src/Notifications/Properties/launchSettings.json @@ -22,6 +22,15 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Notifications-SelfHost": { + "commandName": "Project", + "launchBrowser": false, + "applicationUrl": "http://localhost:61841", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development", + "developSelfHosted": "true" + } } } -} \ No newline at end of file +}