Ejemplo n.º 1
0
        public async Task <Token> AddPlayerAsync(string username)
        {
            var gameTokenValue = await _keyGenerator.GenerateGameTokenAsync(username);

            var token = new Token
            {
                Value          = gameTokenValue,
                ExpirationDate = DateTime.UtcNow.Add(new TimeSpan(0, 0, 30, 0)) /* 30 min in the future. */
            };
            await _vault.AddGameTokenAsync(token);

            _players.Add(new Player
            {
                Name      = username,
                Status    = PlayerStatus.Online,
                GameToken = gameTokenValue
            });
            return(token);
        }