Exemple #1
0
        public static void ConfigureSignalR(IDependencyResolver dependencyResolver, IHubPipeline hubPipeline)
        {
            // Uncomment the following line to enable scale-out using SQL Server
            //dependencyResolver.UseSqlServer(ConfigurationManager.ConnectionStrings["SignalRSamples"].ConnectionString);

            hubPipeline.AddModule(new SamplePipelineModule());
            hubPipeline.EnableAutoRejoiningGroups();
        }
Exemple #2
0
        public static void ConfigureSignalR(IDependencyResolver dependencyResolver, IHubPipeline hubPipeline)
        {
            // Uncomment the following line to enable scale-out using SQL Server
            //dependencyResolver.UseSqlServer(ConfigurationManager.ConnectionStrings["SignalRSamples"].ConnectionString);

            hubPipeline.AddModule(new SamplePipelineModule());
            hubPipeline.EnableAutoRejoiningGroups();
        }
        /// <summary>
        /// By default, clients that are reconnecting to the server will be removed from all groups they may have previously been a member of.
        /// Enabling AutoRejoiningGroups allows all clients to rejoin the all of the hub groups the claim to be a member of automatically
        /// on connect and reconnect.
        /// Enabling this module may be insecure because untrusted clients may claim to be a member of groups they were never authorized to join.
        /// </summary>
        /// <param name="pipeline">The <see cref="IHubPipeline" /> to which the <see cref="AutoRejoiningGroupsModule" /> will be added.</param>
        public static void EnableAutoRejoiningGroups(this IHubPipeline pipeline)
        {
            if (pipeline == null)
            {
                throw new ArgumentNullException("pipeline");
            }

            pipeline.AddModule(new AutoRejoiningGroupsModule());
        }
Exemple #4
0
        public static void ConfigureSignalR(IDependencyResolver dependencyResolver, IHubPipeline hubPipeline)
        {
            // Uncomment the following line to enable scale-out using SQL Server
            // dependencyResolver.UseSqlServer(ConfigurationManager.ConnectionStrings["SignalRSamples"].ConnectionString);

            // Uncomment the following line to enable scale-out using Redis
            // dependencyResolver.UseRedis("127.0.0.1", 6379, "", new[] { "SignalRSamples" });

            hubPipeline.AddModule(new SamplePipelineModule());
        }
Exemple #5
0
        public static void ConfigureSignalR(IDependencyResolver dependencyResolver, IHubPipeline hubPipeline)
        {
            // Uncomment the following line to enable scale-out using SQL Server
            // dependencyResolver.UseSqlServer(ConfigurationManager.ConnectionStrings["SignalRSamples"].ConnectionString);

            // Uncomment the following line to enable scale-out using Redis
            // dependencyResolver.UseRedis("127.0.0.1", 6379, "", new[] { "SignalRSamples" });

            hubPipeline.AddModule(new SamplePipelineModule());
        }
Exemple #6
0
        /// <summary>
        /// Requiring Authentication adds an <see cref="AuthorizeModule"/> to the <see cref="IHubPipeline" /> with <see cref="IAuthorizeHubConnection"/>
        /// and <see cref="IAuthorizeHubMethodInvocation"/> authorizers that will be applied globally to all hubs and hub methods.
        /// These authorizers require that the <see cref="System.Security.Principal.IPrincipal"/>'s <see cref="System.Security.Principal.IIdentity"/>
        /// IsAuthenticated for any clients that invoke server-side hub methods or receive client-side hub method invocations.
        /// </summary>
        /// <param name="pipeline">The <see cref="IHubPipeline" /> to which the <see cref="AuthorizeModule" /> will be added.</param>
        public static void RequireAuthentication(this IHubPipeline pipeline)
        {
            if (pipeline == null)
            {
                throw new ArgumentNullException("pipeline");
            }

            var authorizer = new AuthorizeAttribute();

            pipeline.AddModule(new AuthorizeModule(globalConnectionAuthorizer: authorizer, globalInvocationAuthorizer: authorizer));
        }
Exemple #7
0
        private void Configure(IOwinConfiguration owin)
        {
            if (owin == null)
            {
                throw new ArgumentNullException(nameof(owin));
            }

            owin.Http.Routes.IgnoreRoute("signalR", "signalr/{*pathInfo}");

            IDependencyResolver resolver =
                GlobalHost.DependencyResolver =
                    new CustomResolver(GlobalHost.DependencyResolver, owin.Kernel);

            var hubConfiguration = new HubConfiguration
            {
                Resolver                = resolver,
                EnableDetailedErrors    = _enableDetailedErrors,
                EnableJavaScriptProxies = _enableJavaScriptProxies,
                EnableJSONP             = _enableJSONP
            };

            resolver.Register(typeof(IAssemblyLocator), () => new CustomAssemblyLocator(_assemblies));
            resolver.Register(typeof(IHubActivator), () => new CustomHubActivator(resolver));
            resolver.Register(typeof(IHubDescriptorProvider), () => new CustomHubDescriptorProvider(resolver, owin.Kernel.Resolve <IHubsProvider>()));

            IHubPipeline hubPipeline = resolver.Resolve <IHubPipeline>();

            foreach (var pipelineModule in owin.Kernel.ResolveAll <IHubPipelineModule>())
            {
                hubPipeline.AddModule(pipelineModule);
            }

            owin.App.Map(_path, subApp =>
            {
                _onMap?.Invoke(subApp);

                subApp.RunSignalR(hubConfiguration);
            });

            // TODO: Look at the possibility to add custom trace sources programatically
            // https://msdn.microsoft.com/en-us/library/ms228984(v=vs.110).aspx

            if (!_skipTraceConfiguration)
            {
                ITraceManager traceManager = resolver.Resolve <ITraceManager>();
                traceManager.Switch.Level = _traceLevel;
            }
        }
        public static void ConfigureSignalR(IDependencyResolver dependencyResolver, IHubPipeline hubPipeline)
        {
            // Uncomment the following line to enable scale-out using SQL Server
            //dependencyResolver.UseSqlServer(System.Configuration.ConfigurationManager.ConnectionStrings["SignalRSamples"].ConnectionString);

            // Uncomment the following line to enable scale-out using Redis
            //var config = new RedisScaleoutConfiguration("127.0.0.1", 6379, "", "SignalRSamples");
            //config.RetryOnError = true;
            //dependencyResolver.UseRedis(config);
            //dependencyResolver.UseRedis("127.0.0.1", 6379, "", "SignalRSamples");

            // Uncomment the following line to enable scale-out using service bus
            //dependencyResolver.UseServiceBus("connection string", "Microsoft.AspNet.SignalR.Samples");

            hubPipeline.AddModule(new SamplePipelineModule());
        }
Exemple #9
0
        public static void ConfigureSignalR(IDependencyResolver dependencyResolver, IHubPipeline hubPipeline)
        {
            // Uncomment the following line to enable scale-out using SQL Server
            //dependencyResolver.UseSqlServer(System.Configuration.ConfigurationManager.ConnectionStrings["SignalRSamples"].ConnectionString);

            // Uncomment the following line to enable scale-out using Redis
            //var config = new RedisScaleoutConfiguration("127.0.0.1", 6379, "", "SignalRSamples");
            //config.RetryOnError = true;
            //dependencyResolver.UseRedis(config);
            //dependencyResolver.UseRedis("127.0.0.1", 6379, "", "SignalRSamples");

            // Uncomment the following line to enable scale-out using service bus
            //dependencyResolver.UseServiceBus("connection string", "Microsoft.AspNet.SignalR.Samples");

            hubPipeline.AddModule(new SamplePipelineModule());
        }
Exemple #10
0
        public static void ConfigureSignalR(IDependencyResolver dependencyResolver, IHubPipeline hubPipeline)
        {
            // Uncomment the following line to enable scale-out using SQL Server
            //dependencyResolver.UseSqlServer(System.Configuration.ConfigurationManager.ConnectionStrings["SignalRSamples"].ConnectionString);

            // Uncomment the following line to enable scale-out using Redis
            //var redisConnection = ConfigurationManager.AppSettings["redis:connectionString"];
            //if (!string.IsNullOrEmpty(redisConnection))
            //{
            //    dependencyResolver.UseRedis(new RedisScaleoutConfiguration(redisConnection, "SignalRSamples"));
            //}

            // Uncomment the following line to enable scale-out using service bus
            //dependencyResolver.UseServiceBus("connection string", "Microsoft.AspNet.SignalR.Samples");

            hubPipeline.AddModule(new SamplePipelineModule());
        }
Exemple #11
0
        public static void ConfigureSignalR(IDependencyResolver dependencyResolver, IHubPipeline hubPipeline)
        {
            // Uncomment the following line to enable scale-out using SQL Server
            //SignalRScaleOutDatabase(ref dependencyResolver);
            string connection = string.Empty;

            try
            {
                ClubCloudServiceClient client = new ClubCloudServiceClient(SPServiceContext.Current);
                connection = client.ScaleOutConnection("ClubCloudService_SignalR");
            }
            catch { }
            finally
            {
                if (!string.IsNullOrWhiteSpace(connection))
                {
                    dependencyResolver.UseSqlServer(connection);
                }
            }

            // Any connection or hub wire up and configuration should go here
            hubPipeline.AddModule(new ClubCloudPipelineModule());
        }
Exemple #12
0
        public static void RequireAuthentication(this IHubPipeline pipeline)
        {
            var authorizer = new AuthorizeAttribute();

            pipeline.AddModule(new AuthorizeModule(globalConnectionAuthorizer: authorizer, globalInvocationAuthorizer: authorizer));
        }
Exemple #13
0
 public static void EnableAutoRejoiningGroups(this IHubPipeline pipeline)
 {
     pipeline.AddModule(new AutoRejoiningGroupsModule());
 }
 public static void ConfigureSignalR(IDependencyResolver dependencyResolver, IHubPipeline hubPipeline)
 {
     hubPipeline.AddModule(new SamplePipelineModule());
 }