https://github.com/loresoft/cosmos.identity
Cosmos DB provider for ASP.NET Core Identity framework
https://github.com/loresoft/cosmos.identity
cosmos cosmosdb documentdb identity identity-framework
Last synced: 2 months ago
JSON representation
Cosmos DB provider for ASP.NET Core Identity framework
- Host: GitHub
- URL: https://github.com/loresoft/cosmos.identity
- Owner: loresoft
- License: mit
- Created: 2021-01-15T17:04:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-06T02:14:21.000Z (2 months ago)
- Last Synced: 2025-05-07T04:48:06.320Z (2 months ago)
- Topics: cosmos, cosmosdb, documentdb, identity, identity-framework
- Language: C#
- Homepage:
- Size: 837 KB
- Stars: 2
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Cosmos.Identity
Cosmos DB provider for ASP.NET Core Identity framework[](https://github.com/loresoft/Cosmos.Identity/actions/workflows/dotnet.yml)
[](https://www.nuget.org/packages/Cosmos.Identity/)
[](https://coveralls.io/github/loresoft/Cosmos.Identity?branch=main)
## Download
The Cosmos.Identity library is available on nuget.org via package name `Cosmos.Identity`.
To install Cosmos.Identity, run the following command in the Package Manager Console
PM> Install-Package Cosmos.Identity
More information about NuGet package available at## Usage
appsettings.json configuration
```json
{
"CosmosRepository": {
"ConnectionString": "AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==",
"DatabaseId": "SampleWebsite",
"OptimizeBandwidth": false,
"AllowBulkExecution": true
}
}
```Startup.cs
```c#
using Cosmos.Identity;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using IdentityRole = Cosmos.Identity.IdentityRole;
using IdentityUser = Cosmos.Identity.IdentityUser;namespace Sample.Website
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddCosmosRepository();services
.AddIdentity()
.AddCosmosStores()
.AddDefaultUI()
.AddDefaultTokenProviders();services.AddRazorPages();
}public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseHttpsRedirection();
app.UseStaticFiles();app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
});
}
}
}
```