1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-06 21:48:12 -05:00
bitwarden/src/Hub/Controllers/NotificationController.cs
2018-08-16 12:05:01 -04:00

28 lines
781 B
C#

using System.Threading.Tasks;
using Bit.Core.Models;
using Bit.Core.Utilities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
namespace Bit.Hub
{
[Authorize("Internal")]
[SelfHosted(SelfHostedOnly = true)]
public class NotificationController : Controller
{
private readonly IHubContext<SyncHub> _syncHubContext;
public NotificationController(IHubContext<SyncHub> syncHubContext)
{
_syncHubContext = syncHubContext;
}
[HttpPost("~/notification")]
public async Task PostNotification([FromBody]PushNotificationData<object> model)
{
await HubHelpers.SendNotificationToHubAsync(model, _syncHubContext);
}
}
}