Microsoft.AspNet.SignalR.HubPipelineExtensions.RequireAuthentication C# (CSharp) Method

RequireAuthentication() public static method

Requiring Authentication adds an AuthorizeModule to the IHubPipeline with IAuthorizeHubConnection and IAuthorizeHubMethodInvocation authorizers that will be applied globally to all hubs and hub methods. These authorizers require that the System.Security.Principal.IPrincipal's System.Security.Principal.IIdentity IsAuthenticated for any clients that invoke server-side hub methods or receive client-side hub method invocations.
public static RequireAuthentication ( this pipeline ) : void
pipeline this The to which the will be added.
return void
        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));
        }
    }
HubPipelineExtensions