Esempio n. 1
0
        public async Task <IActionResult> GetAll([FromQuery] string framework, [FromServices] IModulePackageManager modulePackageManager)
        {
            if (string.IsNullOrWhiteSpace(framework))
            {
                return(BadRequest("Framework cannot be empty"));
            }

            var nugetFramework = NuGetFramework.Parse(framework);
            var modules        = await modulePackageManager.GetPackagesLock(nugetFramework);

            return(Ok(modules));
        }
Esempio n. 2
0
        public async Task <IActionResult> Login([FromBody] ClientAuthenticationDto authenticationDto,
                                                [FromServices] IAuthenticateClientAction authenticateClientAction,
                                                [FromServices] ITokenProvider tokenProvider,
                                                [FromServices] IModulePackageManager modulePackageManager)
        {
            var client = await authenticateClientAction.ToRunner(_context).ExecuteAsync(new ClientAuthenticationContext
            {
                Dto       = authenticationDto,
                IpAddress = HttpContext.Connection.RemoteIpAddress
            });

            return(await BizActionStatus(authenticateClientAction, async() =>
            {
                var token = tokenProvider.GetClientToken(client);
                return Ok(new ClientAuthenticationResponse
                {
                    Jwt = tokenProvider.TokenToString(token),
                    Modules = await modulePackageManager.GetPackagesLock(authenticationDto.Framework)
                });
            }));
        }