// llama primero este
        public override bool AuthorizeHubMethodInvocation(Microsoft.AspNet.SignalR.Hubs.IHubIncomingInvokerContext hubIncomingInvokerContext, bool appliesToMethod)
        {
            string token = hubIncomingInvokerContext.Hub.Context.QueryString["uid"];

            if (token != "mytoken")
            {
                return(false);
            }
            return(true);
        }
 public override bool AuthorizeHubMethodInvocation(Microsoft.AspNet.SignalR.Hubs.IHubIncomingInvokerContext hubIncomingInvokerContext, bool appliesToMethod)
 {
     string token = hubIncomingInvokerContext.Hub.Context.Headers["AuthenticationToken"];
     if (string.IsNullOrEmpty(token))
         return false;
     else
     {
         string decryptedValue = Encryptor.Decrypt(token, Encryptor.Password);
         string[] values = decryptedValue.Split(';');
         string userName = values[0],
             deviceId = values[1];
         bool b = ...check if it's ok...
         return b;
     }
 }
Example #3
0
    public override bool AuthorizeHubMethodInvocation(Microsoft.AspNet.SignalR.Hubs.IHubIncomingInvokerContext hubIncomingInvokerContext, bool appliesToMethod)
    {
        string token = hubIncomingInvokerContext.Hub.Context.Headers["AuthenticationToken"];

        if (string.IsNullOrEmpty(token))
        {
            return(false);
        }
        else
        {
            string   decryptedValue = Encryptor.Decrypt(token, Encryptor.Password);
            string[] values         = decryptedValue.Split(';');
            string   userName       = values[0],
                     deviceId       = values[1],
                     connectionId   = values[2];
            bool b = ...CanAccess()...;
            return(b);
        }
    }
 protected override void OnIncomingError(Microsoft.AspNet.SignalR.Hubs.ExceptionContext exceptionContext, Microsoft.AspNet.SignalR.Hubs.IHubIncomingInvokerContext invokerContext)
 {
     System.Diagnostics.Debug.WriteLine("SignalR Exception thrown: {0}", exceptionContext.Error);
     base.OnIncomingError(exceptionContext, invokerContext);
 }
Example #5
0
 static bool AuthorizeClaimsAttribute_OnAuthorizeHubMethodInvocationEvent(Microsoft.AspNet.SignalR.Hubs.IHubIncomingInvokerContext hubIncomingInvokerContext, bool appliesToMethod)
 {
     return(false);//
 }