Microsoft.AspNet.SignalR.AuthorizeAttribute.UserAuthorized C# (CSharp) Method

UserAuthorized() protected method

When overridden, provides an entry point for custom authorization checks. Called by AuthorizeAttribute.AuthorizeHubConnection and AuthorizeAttribute.AuthorizeHubMethodInvocation.
protected UserAuthorized ( IPrincipal user ) : bool
user IPrincipal The for the client being authorize
return bool
        protected virtual bool UserAuthorized(IPrincipal user)
        {
            if (user == null)
            {
                return false;
            }

            if (!user.Identity.IsAuthenticated)
            {
                return false;
            }

            if (_usersSplit.Length > 0 && !_usersSplit.Contains(user.Identity.Name, StringComparer.OrdinalIgnoreCase))
            {
                return false;
            }

            if (_rolesSplit.Length > 0 && !_rolesSplit.Any(user.IsInRole))
            {
                return false;
            }

            return true;
        }