コード例 #1
0
        public override bool AuthorizeHubMethodInvocation(Microsoft.AspNet.SignalR.Hubs.IHubIncomingInvokerContext hubIncomingInvokerContext, bool appliesToMethod)
        {
            var    connectionId = hubIncomingInvokerContext.Hub.Context.ConnectionId;
            var    environment  = hubIncomingInvokerContext.Hub.Context.Request.Environment;
            string hashToken    = hubIncomingInvokerContext.Hub.Context.Request.QueryString.Get("hashToken");
            string id           = hubIncomingInvokerContext.Hub.Context.Request.QueryString.Get("id");
            bool   isAuthorized = Service.CheckIdentity(hashToken, id);

            if (isAuthorized)
            {
                hubIncomingInvokerContext.Hub.Context = new HubCallerContext(new ServerRequest(environment), connectionId);
                return(true);
            }
            return(false);
        }
コード例 #2
0
 public override bool AuthorizeHubMethodInvocation(Microsoft.AspNet.SignalR.Hubs.IHubIncomingInvokerContext hubIncomingInvokerContext, bool appliesToMethod)
 {
     return(true);
 }