Browse Source

Merge pull request #21934 from abpframework/auto-merge/rel-9-0/3407

Merge branch rel-9.1 with rel-9.0
pull/21935/head
maliming 2 years ago
committed by GitHub
parent
commit
43d289bad2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 33
      docs/en/framework/infrastructure/settings.md

33
docs/en/framework/infrastructure/settings.md

@ -160,6 +160,39 @@ Setting values should be configured under the `Settings` section as like in this
> `IConfiguration` is an .NET Core service and it can read values not only from the `appsettings.json`, but also from the environment, user secrets... etc. See [Microsoft's documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/) for more. > `IConfiguration` is an .NET Core service and it can read values not only from the `appsettings.json`, but also from the environment, user secrets... etc. See [Microsoft's documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/) for more.
#### Encrypting Setting Values in the Application Configuration
You have to use the `ISettingEncryptionService` to encrypt the setting values when the `IsEncrypted` property of a setting definition is set to `true`, which means that the setting value should be encrypted in the `appsettings.json`.
Example of injecting the `ISettingEncryptionService` into a class and encrypting the plain text:
````csharp
public class MyService
{
private readonly ISettingEncryptionService _encryptionService;
public MyService(ISettingEncryptionService encryptionService)
{
_encryptionService = encryptionService;
}
public void EncryptValue(string plainText)
{
var ciphertext = _encryptionService.Encrypt(plainText);
}
}
````
Then, Replace `ENCRYPTED_VALUE_HERE` with the ciphertext generated by `ISettingEncryptionService.Encrypt` method.
````json
{
"Settings": {
"MySetting": "ENCRYPTED_VALUE_HERE"
}
}
````
### Custom Setting Value Providers ### Custom Setting Value Providers
If you need to extend the setting system, you can define a class derived from the `SettingValueProvider` class. Example: If you need to extend the setting system, you can define a class derived from the `SettingValueProvider` class. Example:

Loading…
Cancel
Save