From 5545c302a282392398991a40f69137501446603b Mon Sep 17 00:00:00 2001 From: hotchkj Date: Sat, 2 Jul 2016 20:18:19 +0100 Subject: [PATCH] Update README.md documentation to new NET Core style --- README.md | 57 +++++++++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index d9c0394..30081e5 100644 --- a/README.md +++ b/README.md @@ -16,28 +16,25 @@ In Startup.cs, specified as part of DataProtection configuration: ```csharp public void ConfigureServices(IServiceCollection services) { - services.AddDataProtection(); - services.ConfigureDataProtection(configure => - { - configure.PersistKeysToAwsS3(new AmazonS3Client(), new S3XmlRepositoryConfig("my-bucket-name") - // Configuration has defaults; all below are optional - { - // How many concurrent connections will be made to S3 to retrieve key data - MaxS3QueryConcurrency = 10, - // Custom prefix in the S3 bucket enabling use of folders - KeyPrefix = "MyKeys/", - // Customise storage class for key storage - StorageClass = S3StorageClass.Standard, - // Customise encryption options (these can be mutually exclusive - don't just copy & paste!) - ServerSideEncryptionMethod = ServerSideEncryptionMethod.AES256, - ServerSideEncryptionCustomerMethod = ServerSideEncryptionCustomerMethod.AES256, - ServerSideEncryptionCustomerProvidedKey = "MyBase64Key", - ServerSideEncryptionCustomerProvidedKeyMD5 = "MD5OfMyBase64Key", - ServerSideEncryptionKeyManagementServiceKeyId = "AwsKeyManagementServiceId", - // Compress stored XML before write to S3 - ClientSideCompression = true - }); - }); + services.AddDataProtection() + .PersistKeysToAwsS3(new AmazonS3Client(), new S3XmlRepositoryConfig("my-bucket-name") + // Configuration has defaults; all below are optional + { + // How many concurrent connections will be made to S3 to retrieve key data + MaxS3QueryConcurrency = 10, + // Custom prefix in the S3 bucket enabling use of folders + KeyPrefix = "MyKeys/", + // Customise storage class for key storage + StorageClass = S3StorageClass.Standard, + // Customise encryption options (these can be mutually exclusive - don't just copy & paste!) + ServerSideEncryptionMethod = ServerSideEncryptionMethod.AES256, + ServerSideEncryptionCustomerMethod = ServerSideEncryptionCustomerMethod.AES256, + ServerSideEncryptionCustomerProvidedKey = "MyBase64Key", + ServerSideEncryptionCustomerProvidedKeyMD5 = "MD5OfMyBase64Key", + ServerSideEncryptionKeyManagementServiceKeyId = "AwsKeyManagementServiceId", + // Compress stored XML before write to S3 + ClientSideCompression = true + }); } ``` If the `IAmazonS3` interface is discoverable via Dependency Injection in `IServiceCollection`, the constructor argument of `AmazonS3Client` can be omitted. @@ -54,15 +51,13 @@ In Startup.cs, specified as part of DataProtection configuration: ```csharp public void ConfigureServices(IServiceCollection services) { - services.AddDataProtection(); - services.ConfigureDataProtection(configure => - { - var kmsConfig = new KmsXmlEncryptorConfig("my-application-name", "alias/MyKmsAlias"); - // Configuration has default contexts added; below are optional if using grants or additional contexts - kmsConfig.EncryptionContext.Add("my-custom-context", "my-custom-value"); - kmsConfig.GrantTokens.Add("my-grant-token"); - configure.ProtectKeysWithAwsKms(new AmazonKeyManagementServiceClient(), kmsConfig); - }); + var kmsConfig = new KmsXmlEncryptorConfig("my-application-name", "alias/MyKmsAlias"); + // Configuration has default contexts added; below are optional if using grants or additional contexts + kmsConfig.EncryptionContext.Add("my-custom-context", "my-custom-value"); + kmsConfig.GrantTokens.Add("my-grant-token"); + + services.AddDataProtection() + .ProtectKeysWithAwsKms(new AmazonKeyManagementServiceClient(), kmsConfig); } ``` If the `IAmazonKeyManagementService` interface is discoverable via Dependency Injection in `IServiceCollection`, the constructor argument of `AmazonKeyManagementServiceClient` can be omitted. \ No newline at end of file