public virtual async Task <int> DeleteClientSecretAsync(ClientSecretsDto clientSecret) { var clientSecretEntity = clientSecret.ToEntity(); var deleted = await ClientRepository.DeleteClientSecretAsync(clientSecretEntity); await AuditEventLogger.LogEventAsync(new ClientSecretDeletedEvent(clientSecret.ClientId, clientSecret.ClientSecretId)); return(deleted); }
public virtual async Task <int> AddClientSecretAsync(ClientSecretsDto clientSecret) { HashClientSharedSecret(clientSecret); var clientSecretEntity = clientSecret.ToEntity(); var added = await ClientRepository.AddClientSecretAsync(clientSecret.ClientId, clientSecretEntity); await AuditEventLogger.LogEventAsync(new ClientSecretAddedEvent(clientSecret.ClientId, clientSecret.Type, clientSecret.Expiration)); return(added); }
public async Task <IActionResult> DeleteSecret(int secretId) { var clientSecret = new ClientSecretsDto { ClientSecretId = secretId }; await _clientService.GetClientSecretAsync(clientSecret.ClientSecretId); await _clientService.DeleteClientSecretAsync(clientSecret); return(Ok()); }
public async Task <IActionResult> ClientSecretDelete(ClientSecretsDto clientSecret) { if (await IsUserManagerOrAdmin(clientSecret.ClientId)) { await _clientService.DeleteClientSecretAsync(clientSecret); SuccessNotification(_localizer["SuccessDeleteClientSecret"], _localizer["SuccessTitle"]); } else { UnauthorizedNotification(); } return(RedirectToAction(nameof(ClientSecrets), new { Id = clientSecret.ClientId })); }
private void HashClientSharedSecret(ClientSecretsDto clientSecret) { if (clientSecret.Type != SharedSecret) { return; } if (clientSecret.HashTypeEnum == HashType.Sha256) { clientSecret.Value = clientSecret.Value.Sha256(); } else if (clientSecret.HashTypeEnum == HashType.Sha512) { clientSecret.Value = clientSecret.Value.Sha512(); } }
private void HashClientSharedSecret(ClientSecretsDto clientSecret) { if (clientSecret.Type != SharedSecret) { return; } if (clientSecret.HashType == ((int)HashType.Sha256).ToString()) { clientSecret.Value = clientSecret.Value.Sha256(); } else if (clientSecret.HashType == ((int)HashType.Sha512).ToString()) { clientSecret.Value = clientSecret.Value.Sha512(); } }
public static ClientSecret ToEntity(this ClientSecretsDto clientSecret, IMapper mapper) { return(mapper.Map <ClientSecret>(clientSecret)); }
public async Task <int> DeleteClientSecretAsync(ClientSecretsDto clientSecret) { var clientSecretEntity = clientSecret.ToEntity(); return(await _clientRepository.DeleteClientSecretAsync(clientSecretEntity)); }