Beispiel #1
0
        private async Task GetFlagFromToken(CheckerTaskMessage task, CancellationToken token)
        {
            this.logger.LogInformation("Fetching Token From Db");
            string?gtoken = await this.checkerDb.GetTokenUUIDAsync(task.Flag !, token);

            if (gtoken == null)
            {
                throw new MumbleException("Putflag failed");
            }

            var users = await this.checkerDb.GetUsersAsync(task.Flag !, token);

            if (users == null || users.Count != 1)
            {
                this.logger.LogInformation($"Master User for the Token not found in Db, or multiple found for the flag: Count:{((users != null) ? users.Count : -1)}");
                throw new MumbleException("Putflag failed");
            }

            using var mclient = this.serviceProvider.GetRequiredService <GamemasterClient>();
            TokenStrippedView retrievedToken = await mclient.CheckTokenAsync(task.Address, gtoken, token);

            if (!retrievedToken.Description.Equals(task.Flag))
            {
                throw new MumbleException("Flag not found in token");
            }
        }
        public async Task <IActionResult> Info([FromForm] string UUID)
        {
            TokenStrippedView t = await Db.GetTokenByUUID(UUID);

            if (t.UUID == UUID)
            {
                return(Json(t));
            }
            else
            {
                return(NotFound());
            }
        }