SignalR.EventStream.Authorize C# (CSharp) Method

Authorize() public method

public Authorize ( string authorizeFor = "authorized" ) : bool
authorizeFor string
return bool
        public bool Authorize(string authorizeFor = "authorized")
        {

            //use dependency injection to find if user is authorized
            var authorize = Infrastructure.DependencyResolver.Resolve<IStreamAuthorize>();
            if (authorize != null) {

                string userId = Context.ClientId;
                if (authorize.Authorized(ref userId, Context.User, authorizeFor)) {
                    //validate user id
                    //string id = Context.ClientId == "null" ? null : Context.ClientId;
                    if (userId == null) userId = Context.ClientId;

                    ConnectionManager.AddConnection(Context.ClientId, userId);

                    AddToGroup(authorizeFor);
                    return true;
                }
            }
            return false;
        }