Browse Source

Merge pull request #11985 from abpframework/SettingEncryptionService

Return empty if decrypt failed.
pull/11986/head
liangshiwei 5 years ago
committed by GitHub
parent
commit
07ab3c9f76
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingEncryptionService.cs

14
framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingEncryptionService.cs

@ -1,4 +1,6 @@
using System;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Security.Encryption;
@ -7,10 +9,12 @@ namespace Volo.Abp.Settings;
public class SettingEncryptionService : ISettingEncryptionService, ITransientDependency
{
protected IStringEncryptionService StringEncryptionService { get; }
public ILogger<SettingEncryptionService> Logger { get; set; }
public SettingEncryptionService(IStringEncryptionService stringEncryptionService)
{
StringEncryptionService = stringEncryptionService;
Logger = NullLogger<SettingEncryptionService>.Instance;
}
public virtual string Encrypt(SettingDefinition settingDefinition, string plainValue)
@ -30,6 +34,14 @@ public class SettingEncryptionService : ISettingEncryptionService, ITransientDep
return encryptedValue;
}
return StringEncryptionService.Decrypt(encryptedValue);
try
{
return StringEncryptionService.Decrypt(encryptedValue);
}
catch (Exception e)
{
Logger.LogException(e);
return string.Empty;
}
}
}

Loading…
Cancel
Save