Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateClientSecret([FromRoute] Guid id, [FromBody] UpdateClientSecretCommand command)
        {
            command.Id = id;
            var clientSecret = await _mediator.Send(command);

            return(Ok(clientSecret));
        }
Ejemplo n.º 2
0
 public async Task<IActionResult> UpdateSecret(Guid id)
 {
     var cmd = new UpdateClientSecretCommand { ClientId = id };
     var result = await _sagaBus.InvokeAsync<UpdateClientSecretCommand, ClientSecretUpdateResult>(cmd);
     if (result.Succeed)
     {
         return Created(Url.Action(), null);
     }
     return BadRequest(result.Message);
 }
        public async Task <ClientSecret> Handle(UpdateClientSecretCommand message, CancellationToken cancellationToken)
        {
            var client = await _repository.GetById(message.Id) ?? throw new NotFoundException();

            client.GenerateNewClientId();

            await _repository.SaveAsync(client);

            return(client.ClientSecrets.First());
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> UpdateSecret(Guid id)
        {
            var cmd = new UpdateClientSecretCommand {
                ClientId = id
            };
            var result = await _sagaBus.InvokeAsync <UpdateClientSecretCommand, ClientSecretUpdateResult>(cmd);

            if (result.Succeed)
            {
                return(Created(Url.Action(), null));
            }
            return(BadRequest(result.Message));
        }