Beispiel #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));
        }
Beispiel #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());
        }
        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));
        }