Esempio n. 1
0
        public bool TryPrepareUserFrom(Microsoft.AspNetCore.SignalR.HubCallerContext context, out SampleUser tfUser)
        {
            tfUser = null;

            var claim = context.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier);

            if (claim == null)
            {
                return(false);
            }

            try
            {
                Guid userId = Guid.Parse(claim.Value);
                var  obo    = context.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.UserData);

                UserModel user = null, oboUser = null;

                var rsC = this.DataManager.QueryUser(userId, IncludeOptions.None).GetAwaiter().GetResult();
                if (rsC.Code != ResponseCode.Ok)
                {
                    return(false);
                }
                user = rsC.Data[0].User;

                if (obo != null)
                {
                    rsC = this.DataManager.QueryUser(obo.Value.Decode(), IncludeOptions.None).GetAwaiter().GetResult();
                    if (rsC.Code != ResponseCode.Ok)
                    {
                        return(false);
                    }
                    oboUser = rsC.Data[0].User;
                }

                tfUser = new SampleUser(user, context.User.Identity, oboUser);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 2
0
        public static void Configure(String nameQueue, ChatHub hub)
        {
            Microsoft.AspNetCore.SignalR.IHubCallerClients clients = hub.Clients;
            Microsoft.AspNetCore.SignalR.HubCallerContext  context = hub.Context;
            Microsoft.AspNetCore.SignalR.IGroupManager     group   = hub.Groups;

            BusControl = Bus.Factory.CreateUsingRabbitMq(cfg =>
            {
                cfg.AutoDelete = true;
                var host       = cfg.Host(new Uri(_configuration["BusMensage:host"]), h =>
                {
                    h.Username(_configuration["BusMensage:user"]);
                    h.Password(_configuration["BusMensage:password"]);
                });

                cfg.ReceiveEndpoint(host, nameQueue, e => {
                    e.Consumer(() => new CheckinCommandProveedores(clients, context, group));
                });
            });

            BusControl.Start();
        }
 public HubInvocationContext(Microsoft.AspNetCore.SignalR.HubCallerContext context, System.Type hubType, string hubMethodName, object[] hubMethodArguments)
 {
 }
 public HubLifetimeContext(Microsoft.AspNetCore.SignalR.HubCallerContext context, System.IServiceProvider serviceProvider, Microsoft.AspNetCore.SignalR.Hub hub)
 {
 }
 public HubInvocationContext(Microsoft.AspNetCore.SignalR.HubCallerContext context, System.IServiceProvider serviceProvider, Microsoft.AspNetCore.SignalR.Hub hub, System.Reflection.MethodInfo hubMethod, System.Collections.Generic.IReadOnlyList <object> hubMethodArguments)
 {
 }
Esempio n. 6
0
 public static Microsoft.AspNetCore.Http.HttpContext GetHttpContext(this Microsoft.AspNetCore.SignalR.HubCallerContext connection)
 {
     throw null;
 }