mirror of
https://github.com/bitwarden/server.git
synced 2026-02-04 08:03:29 +08:00
20 lines
589 B
C#
20 lines
589 B
C#
|
|
using Microsoft.AspNetCore.Authorization;
|
|||
|
|
using Microsoft.AspNetCore.SignalR;
|
|||
|
|
|
|||
|
|
namespace Bit.Notifications;
|
|||
|
|
|
|||
|
|
[AllowAnonymous]
|
|||
|
|
public class AnonymousNotificationsHub : Microsoft.AspNetCore.SignalR.Hub, INotificationHub
|
|||
|
|
{
|
|||
|
|
public override async Task OnConnectedAsync()
|
|||
|
|
{
|
|||
|
|
var httpContext = Context.GetHttpContext();
|
|||
|
|
var token = httpContext.Request.Query["Token"].FirstOrDefault();
|
|||
|
|
if (!string.IsNullOrWhiteSpace(token))
|
|||
|
|
{
|
|||
|
|
await Groups.AddToGroupAsync(Context.ConnectionId, token);
|
|||
|
|
}
|
|||
|
|
await base.OnConnectedAsync();
|
|||
|
|
}
|
|||
|
|
}
|