aws / aws-ssm-data-protection-provider-for-aspnet

An extension library to assist with ASP.NET data protection in AWS Lambda.
Apache License 2.0
58 stars 21 forks source link

PersistKeysToAWSSystemsManager not accessible #16

Closed clarotech closed 4 years ago

clarotech commented 4 years ago

Using .NET Core 3.1

References `

<PackageReference Include="Microsoft.AspNetCore.DataProtection.Extensions" Version="3.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.3" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="17.4.0.55" />`

When using the following code, an error is raised on services.AddDataProtection().PersistKeysToAWSSystemsManager("/MyApplication/DataProtection"); stating

'IDataProtectionBuilder' does not contain a definition for 'PersistKeysToAWSSystemsManager' and no accessible extension method 'PersistKeysToAWSSystemsManager' accepting a first argument of type 'IDataProtectionBuilder' could be found (are you missing a using directive or an assembly reference?)

The following Using statements are present

using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Newtonsoft.Json.Serialization; using NFR_Admin.Services; using Syncfusion.Licensing; using Amazon.SimpleSystemsManagement; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.DataProtection.Extensions

Is there a compatibility issue somewhere?

ganeshnj commented 4 years ago

@clarotech you need to use Amazon.AspNetCore.DataProtection.SSM as a direct dependency, which contains the extension method PersistKeysToAWSSystemsManager.

Additionally, you don't have to add the transitive dependencies such as mazon.Extensions.Configuration.SystemsManager & AWSSDK.SimpleSystemsManagement.