Microsoft.AspNetCore.SignalR.Hubs.HubPipelineModule.BuildAuthorizeConnect C# (CSharp) Method

BuildAuthorizeConnect() public method

Wraps a function to be called before a client subscribes to signals belonging to the hub described by the HubDescriptor. By default, the AuthorizeModule will look for attributes on the IHub to help determine if the client is authorized to subscribe to method invocations for the described hub. The function returns true if the client is authorized to subscribe to client-side hub method invocations; false, otherwise.
public BuildAuthorizeConnect ( Func authorizeConnect ) : Func
authorizeConnect Func /// A function that dictates whether or not the client is authorized to connect to the described Hub. ///
return Func
        public virtual Func<HubDescriptor, HttpRequest, bool> BuildAuthorizeConnect(Func<HubDescriptor, HttpRequest, bool> authorizeConnect)
        {
            return (hubDescriptor, request) =>
            {
                if (OnBeforeAuthorizeConnect(hubDescriptor, request))
                {
                    return authorizeConnect(hubDescriptor, request);
                }
                return false;
            };
        }