1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 17:42:49 -05:00

upgrade to aspnet core 3.1

This commit is contained in:
Kyle Spearrin
2020-01-10 08:33:13 -05:00
parent 8026912eeb
commit 29580684a3
60 changed files with 429 additions and 420 deletions

View File

@ -4,8 +4,7 @@ using Bit.Core.Models.Table;
using Bit.Core.Enums;
using Newtonsoft.Json;
using Bit.Core.Models;
using Microsoft.WindowsAzure.Storage.Queue;
using Microsoft.WindowsAzure.Storage;
using Azure.Storage.Queues;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
@ -13,7 +12,7 @@ namespace Bit.Core.Services
{
public class AzureQueuePushNotificationService : IPushNotificationService
{
private readonly CloudQueue _queue;
private readonly QueueClient _queueClient;
private readonly GlobalSettings _globalSettings;
private readonly IHttpContextAccessor _httpContextAccessor;
@ -26,9 +25,7 @@ namespace Bit.Core.Services
GlobalSettings globalSettings,
IHttpContextAccessor httpContextAccessor)
{
var storageAccount = CloudStorageAccount.Parse(globalSettings.Notifications.ConnectionString);
var queueClient = storageAccount.CreateCloudQueueClient();
_queue = queueClient.GetQueueReference("notifications");
_queueClient = new QueueClient(globalSettings.Notifications.ConnectionString, "notifications");
_globalSettings = globalSettings;
_httpContextAccessor = httpContextAccessor;
}
@ -143,8 +140,7 @@ namespace Bit.Core.Services
var contextId = GetContextIdentifier(excludeCurrentContext);
var message = JsonConvert.SerializeObject(new PushNotificationData<T>(type, payload, contextId),
_jsonSettings);
var queueMessage = new CloudQueueMessage(message);
await _queue.AddMessageAsync(queueMessage);
await _queueClient.SendMessageAsync(message);
}
private string GetContextIdentifier(bool excludeCurrentContext)