Fix: SignalR Authorize & Firefox Compatibility

Changes in architecture to support authorization and temporary
workaround for NTLM in Firefox (to be removed in SignalR 2.x). Thanks to
@davidfowl
This commit is contained in:
Gary Sharp
2013-05-16 19:27:28 +10:00
parent 664cde59eb
commit 06071679a9
17 changed files with 227 additions and 96 deletions
+3 -2
View File
@@ -5,6 +5,7 @@ using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Microsoft.AspNet.SignalR;
using Disco.BI.Interop.SignalRHandlers;
namespace Disco.Web
{
@@ -73,9 +74,9 @@ namespace Disco.Web
public static void RegisterUpdateRoutes(RouteCollection routes)
{
// Task Status SignalR Route
routes.MapConnection<Disco.Services.Tasks.ScheduledTasksLiveStatusService>(
routes.MapConnection<ScheduledTasksStatusNotifications>(
"API_Logging_TaskStatusNotifications",
"API/Logging/TaskStatusNotifications");
"API/Logging/TaskStatusNotifications", new ConnectionConfiguration(), SignalRAuthenticationWorkaround.AddMiddleware);
// Task Status Ajax Route
routes.MapRoute(
+7 -6
View File
@@ -1,6 +1,7 @@
using System.Web.Mvc;
using System.Web.Routing;
using Microsoft.AspNet.SignalR;
using Disco.BI.Interop.SignalRHandlers;
namespace Disco.Web.Areas.API
{
@@ -16,14 +17,14 @@ namespace Disco.Web.Areas.API
public override void RegisterArea(AreaRegistrationContext context)
{
context.Routes.MapConnection<Disco.Services.Logging.Targets.LogLiveContext>(
"API_Logging_Notifications", "API/Logging/Notifications");
context.Routes.MapConnection<LogNotifications>(
"API_Logging_Notifications", "API/Logging/Notifications", new ConnectionConfiguration(), SignalRAuthenticationWorkaround.AddMiddleware);
context.Routes.MapConnection<Disco.Services.Tasks.ScheduledTasksLiveStatusService>(
"API_Logging_TaskStatusNotifications", "API/Logging/TaskStatusNotifications");
context.Routes.MapConnection<ScheduledTasksStatusNotifications>(
"API_Logging_TaskStatusNotifications", "API/Logging/TaskStatusNotifications", new ConnectionConfiguration(), SignalRAuthenticationWorkaround.AddMiddleware);
context.Routes.MapConnection<Disco.BI.Interop.SignalRHandlers.RepositoryMonitorNotifications>(
"API_Repository_Notifications", "API/Repository/Notifications");
context.Routes.MapConnection<RepositoryMonitorNotifications>(
"API_Repository_Notifications", "API/Repository/Notifications", new ConnectionConfiguration(), SignalRAuthenticationWorkaround.AddMiddleware);
context.MapRoute(
"API_Update",
@@ -44,7 +44,7 @@
$(function () {
var logEventsHost = $('LogEvents_@(uniqueId)');
var logModuleId = '@(Model.ModuleFilter != null ? Model.ModuleFilter.ModuleId.ToString() : null)';
var logModuleLiveGroupName = '@(Model.ModuleFilter != null ? Model.ModuleFilter.LiveLogGroupName : Disco.Services.Logging.LogContext.LiveLogAllEventsGroupName)';
var logModuleLiveGroupName = '@(Model.ModuleFilter != null ? Model.ModuleFilter.LiveLogGroupName : Disco.BI.Interop.SignalRHandlers.LogNotifications.AllNotifications)';
var logEventTypeFiltered = @(eventTypesFilterJson);
var logStartFiler = @(AjaxHelpers.JsonDate(Model.StartFilter));
var logEndFiler = @(AjaxHelpers.JsonDate(Model.EndFilter));
@@ -196,7 +196,7 @@ WriteLiteral("\';\r\n var logModuleLiveGroupName = \'");
#line 47 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml"
Write(Model.ModuleFilter != null ? Model.ModuleFilter.LiveLogGroupName : Disco.Services.Logging.LogContext.LiveLogAllEventsGroupName);
Write(Model.ModuleFilter != null ? Model.ModuleFilter.LiveLogGroupName : Disco.BI.Interop.SignalRHandlers.LogNotifications.AllNotifications);
#line default
@@ -1,6 +1,7 @@
using System.Web.Mvc;
using System.Web.Routing;
using Microsoft.AspNet.SignalR;
using Disco.BI.Interop.SignalRHandlers;
namespace Disco.Web.Areas.Public
{
@@ -16,8 +17,8 @@ namespace Disco.Web.Areas.Public
public override void RegisterArea(AreaRegistrationContext context)
{
context.Routes.MapConnection<BI.Interop.SignalRHandlers.UserHeldDevices>(
"Public_UserHeldDevices_Notifications", "Public/UserHeldDevices/Notifications");
context.Routes.MapConnection<UserHeldDeviceNotifications>(
"Public_UserHeldDevices_Notifications", "Public/UserHeldDevices/Notifications", new ConnectionConfiguration(), SignalRAuthenticationWorkaround.AddMiddleware);
context.MapRoute(
"Public_Credits",
@@ -402,7 +402,8 @@
var liveMessagesConnection = $.connection('@(Url.Content("~/API/Repository/Notifications"))')
liveMessagesConnection.received(liveMessageRecieved);
liveMessagesConnection.error(function (e) {
alert('Error: ' + JSON.stringify(e));
if (e)
alert('Error: ' + JSON.stringify(e));
});
liveMessagesConnection.start(function () {
liveMessagesConnection.send('/addToGroups:JobLog,JobAttachment');
@@ -786,7 +786,8 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
WriteLiteral(@"')
liveMessagesConnection.received(liveMessageRecieved);
liveMessagesConnection.error(function (e) {
alert('Error: ' + JSON.stringify(e));
if (e)
alert('Error: ' + JSON.stringify(e));
});
liveMessagesConnection.start(function () {
liveMessagesConnection.send('/addToGroups:JobLog,JobAttachment');