public async Task <IActionResult> Token([FromBody] TokenAuthorisationArgs args, [FromServices] HttpPostAuthorizationTokenCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            _Logger.WriteAuthStart();
            return(await command.ExecuteAsync(HttpContext, args));
        }
        public async Task <IActionResult> Token([FromBody] TokenAuthorisationArgs args,
                                                [FromServices] HttpPostAuthorizationTokenCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            _Logger.LogInformation("POST Auth/Token triggered.");
            return(await command.Execute(HttpContext, args));
        }
        public async Task <IActionResult> ExecuteAsync(HttpContext httpContext, TokenAuthorisationArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            var claims = await _AuthCodeService.GetClaimsByAuthCodeAsync(args.Code);

            if (claims == null)
            {
                return(new UnauthorizedResult());
            }

            //TODO: add sliding expiry time to distributed cache
            await _AuthCodeService.RevokeAuthCodeAsync(args.Code);

            var jwtToken = _JwtService.Generate(claims);

            return(new OkObjectResult(new
            {
                Token = jwtToken
            }));
        }