Esempio n. 1
0
        public void Configuration(IAppBuilder app)
        {
            // Fake Authentication!! DO NOT USE IN A REAL APPLICATION
            app.Use(async(context, next) =>
            {
                var userName = context.Request.Query["u"];

                if (!String.IsNullOrEmpty(userName))
                {
                    var claims = new List <Claim>
                    {
                        new Claim(ClaimTypes.Name, userName)
                    };

                    context.Request.User = new ClaimsPrincipal(new ClaimsIdentity(claims, "QueryString"));
                }

                await next();
            });

            var heartBeat = GlobalHost.DependencyResolver.Resolve <ITransportHeartbeat>();

            var monitor = new PresenceMonitor(heartBeat);

            monitor.StartMonitoring();

            app.MapSignalR();
        }
Esempio n. 2
0
        public void Configuration(IAppBuilder app)
        {
            // Fake Authentication!! DO NOT USE IN A REAL APPLICATION
            app.Use(async (context, next) =>
            {
                var userName = context.Request.Query["u"];

                if (!String.IsNullOrEmpty(userName))
                {
                    var claims = new List<Claim>
                    {
                        new Claim(ClaimTypes.Name, userName)
                    };

                    context.Request.User = new ClaimsPrincipal(new ClaimsIdentity(claims, "QueryString"));
                }

                await next();
            });

            var heartBeat = GlobalHost.DependencyResolver.Resolve<ITransportHeartbeat>();

            var monitor = new PresenceMonitor(heartBeat);
            monitor.StartMonitoring();

            app.MapSignalR();
        }