f40409a688
Tracking IDs are review bookkeeping that rots in shipped source; the rationale they tagged is kept. Comment-only change (CommentChecker 458 -> 16 false positives).
38 lines
1.7 KiB
C#
38 lines
1.7 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
namespace ZB.MOM.WW.MxGateway.Server.Dashboard.Hubs;
|
|
|
|
/// <summary>
|
|
/// SignalR hub that pushes alarm-feed messages from the gateway's
|
|
/// central alarm monitor. Connected clients auto-join
|
|
/// <see cref="AllAlarmsGroup"/> on connect and receive every
|
|
/// <c>AlarmFeedMessage</c> the monitor emits.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The feed is galaxy-wide: the alarm monitor is gateway-central and its messages carry no
|
|
/// session provenance, so the per-session tag ACL that scopes <c>EventsHub</c> has nothing
|
|
/// to intersect here and is deliberately not applied — every authenticated Viewer sees the whole
|
|
/// subscription expression's alarm metadata. What is tightened instead is the entry gate:
|
|
/// <see cref="DashboardAuthenticationDefaults.AlarmsPolicy"/> rather than the
|
|
/// <see cref="DashboardAuthenticationDefaults.HubClientsPolicy"/> the other hubs use, so the
|
|
/// read-only environment bypasses (<c>Authentication:Mode=Disabled</c>, anonymous localhost) no
|
|
/// longer receive the feed. The <c>/alarms</c> page carries the same policy — the two readers of
|
|
/// one monitor must not disagree about who may see it.
|
|
/// </remarks>
|
|
[Authorize(Policy = DashboardAuthenticationDefaults.AlarmsPolicy)]
|
|
public sealed class AlarmsHub : Hub
|
|
{
|
|
public const string AllAlarmsGroup = "__alarms__";
|
|
|
|
/// <summary>Method name used to push <c>AlarmFeedMessage</c> values to clients.</summary>
|
|
public const string AlarmMessage = "AlarmFeed";
|
|
|
|
/// <inheritdoc />
|
|
public override async Task OnConnectedAsync()
|
|
{
|
|
await Groups.AddToGroupAsync(Context.ConnectionId, AllAlarmsGroup).ConfigureAwait(false);
|
|
await base.OnConnectedAsync().ConfigureAwait(false);
|
|
}
|
|
}
|