Esempio n. 1
0
        public string GetName()
        {
            if (!_currentUser.IsAuthenticated())
            {
                return(null);
            }
            var user = GetPlayer();

            return(user.DisplayName);
        }
Esempio n. 2
0
        //[EnableCors("AllowAll")]
        public IEnumerable <WeatherForecast> Get()
        {
            var isAuth = _userService.IsAuthenticated();

            var principal = HttpContext.User.Identity as ClaimsIdentity;

            var login = principal.Claims
                        .SingleOrDefault(c => c.Type == ClaimTypes.NameIdentifier)
                        ?.Value;

            var rng = new Random();

            return(Enumerable.Range(1, 5).Select(index => new WeatherForecast
            {
                Date = DateTime.Now.AddDays(index),
                TemperatureC = rng.Next(-20, 55),
                Summary = Summaries[rng.Next(Summaries.Length)]
            })
                   .ToArray());
        }