Skip to content

spudmashmedia/IdentityServer4.Contrib.AwsDynamoDB

Repository files navigation

IdentityServer4.Contrib.AwsDynamoDB

Build status NuGet

Summary

AWS DynamoDB Operational & Persisted store for IdentityServer4

Installation

AWS Setup

Credentials

https://docs.aws.amazon.com/cli/latest/userguide/cli-config-files.html

AWS CLI

See https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html

Generating DynamoDB Tables

See Tools | DynamoDB | Python | Readme.md

Nuget Package

Install-Package IdentityServer4.Contrib.AwsDynamoDB

Quick Setup

Startup.cs

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();

        // 1) setup all services (Also sets up PersistedGrant Store)
        services.AddIs4DynamoDB(Configuration);
        
        // 2) Use ClientRepository + ResourceRepository
        services.AddIdentityServer()
                .AddDeveloperSigningCredential()
                .AddTestUsers(TestUsers.Users)
                .AddClientStore<ClientRepository>()
                .AddResourceStore<ResourceRepository>();
        
        Setup.SeedDynamoDB(
            services,
            Configuration,
            Clients.Get(),
            Resources.GetApiResources(),
            Resources.GetIdentityResources()
        );
    }

appsettings.json

{
  "AWS": {
    "Region": "[region]"
  },
  "IdentityServer4.Contrib.AwsDynamoDB": {
    "TableNamePrefix": "[prefix]"
  }
}
Field Value
[region] AWS region code. E.g. ap-southeast-2
[prefix] This value will prefix the POCO tables. E.g. Development- will be prefixed to Client DynamoDB table name as Development-Client

License

MIT