// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information. using System; using Microsoft.AspNet.SignalR.Hubs; namespace Microsoft.AspNet.SignalR { public static class HubPipelineExtensions { /// /// Requiring Authentication adds an to the with /// and authorizers that will be applied globally to all hubs and hub methods. /// These authorizers require that the 's /// IsAuthenticated for any clients that invoke server-side hub methods or receive client-side hub method invocations. /// /// The to which the will be added. 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)); } } }