public async Task DeleteClientCredentialAsync(DeleteClientCredentialAdto deleteClientCredentialAdto)
        {
            using (ITransaction transaction = _transactionManager.Create())
            {
                try
                {
                    if (!(await _commandRepository.GetWithConcurrencyCheckAsync(deleteClientCredentialAdto.Id, deleteClientCredentialAdto.Version) is AuthenticationGrantTypeClientCredential
                          authenticationGrantTypeClientCredential))
                    {
                        throw new BusinessApplicationException(ExceptionType.NotFound, "Authentication service not found");
                    }

                    await _commandRepository.DeleteAsync(authenticationGrantTypeClientCredential.Id);

                    transaction.Commit();
                }
                catch (ConcurrencyDomainException e)
                {
                    throw new BusinessApplicationException(ExceptionType.Concurrency, e);
                }
                catch (NotFoundDomainException e)
                {
                    throw new BusinessApplicationException(ExceptionType.NotFound, e);
                }
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Delete(Guid id)
        {
            DeleteClientCredentialAdto deleteClientCredentialAdto = new DeleteClientCredentialAdto
            {
                Id      = id,
                Version = _concurrencyVersionProvider.Get()
            };

            await
            _authenticationServiceApplicationService.DeleteClientCredentialAsync(deleteClientCredentialAdto);

            return(NoContent());
        }
 public Task DeleteClientCredentialAsync(DeleteClientCredentialAdto deleteClientCredentialAdto)
 {
     return(_securityApplicationService.SecureAsync(() => _authenticationServiceApplicationService.DeleteClientCredentialAsync(deleteClientCredentialAdto),
                                                    DefaultAuthorisationContext.Create(AuthorisationResource.AuthenticationService, AuthorisationAction.Delete)));
 }