https://github.com/panoukos41/couchdb-openiddict
CouchDB Storage Provider for Openiddict
https://github.com/panoukos41/couchdb-openiddict
aspnetcore couchdb csharp dotnet openiddict
Last synced: 8 months ago
JSON representation
CouchDB Storage Provider for Openiddict
- Host: GitHub
- URL: https://github.com/panoukos41/couchdb-openiddict
- Owner: panoukos41
- License: apache-2.0
- Created: 2021-02-22T16:49:45.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-13T20:27:53.000Z (almost 5 years ago)
- Last Synced: 2025-06-12T03:10:20.096Z (12 months ago)
- Topics: aspnetcore, couchdb, csharp, dotnet, openiddict
- Language: C#
- Homepage:
- Size: 133 KB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# P41.OpenIddict.CouchDB
[](https://github.com/panoukos41/couchdb-openiddict/actions/workflows/release.yaml)
[](https://www.nuget.org/packages/P41.OpenIddict.CouchDB)
[](https://github.com/panoukos41/couchdb-openiddict/blob/main/LICENSE.md)
[CouchDB](https://couchdb.apache.org/) store provider for the [Openiddict](https://github.com/openiddict/openiddict-core) using [CouchDB.NET](https://github.com/matteobortolazzo/couchdb-net).
The project was insipired from the existing [OpenIddict](https://github.com/openiddict/openiddict-core) MongoDB implementation.
# Before Getting started
This project was made in a hurry and was live tested on a really simple application so some things might not work as expected. Feel free to open an issue and even a pull request.
I will try my best to support the project and provide tests and samples whenever i find time.
Thanks for looking at this library 😄
# Getting Started
By default a database named `openiddict` is used but you can change it using the options overload.
Your [CouchDB](https://couchdb.apache.org/) database must implement the [ddoc.json](ddocs/ddoc.json) in the [ddocs](/ddocs) folder.
At your `Startup.cs` add your `ICouchClient` in DI and use the following code.
```csharp
// Configure OpenIddict stores and services.
services.AddOpenIddict()
// Register the OpenIddict core components and to use the CouchDb stores and models.
.AddCore(options => options.UseCouchDb())
```
Or you can provide your own instance of `ICouchClient` in the options.
```csharp
// Configure OpenIddict stores and services.
// With custom client.
services.AddOpenIddict()
// Register the OpenIddict core components and to use the CouchDb stores and models.
.AddCore(options => options
.UseCouchDb(options => options
.UseClient(new CouchClient("http://localhost:5984"))))
```
You can also customize the `design document` and `views` used by the library. More information as to what a view returns and when can be found in the [ddocs](/ddocs) fodler.
```csharp
services.AddIdentity()
.AddCouchDbStores(options => options
.UseViewOptions(new CouchDbOpenIddictViewOptions
{
Document = "openiddict";
Application = "application";
ApplicationClientId = "application.client_id";
ApplicationRedirectUri = "application.redirect_uris";
ApplicationPostLogoutRedirectUri = "application.post_logout_redirect_uris";
Authorization = "authorization";
AuthorizationApplicationId = "authorization.application_id";
AuthorizationSubject = "authorization.subject";
AuthorizationPrune = "authorization.prune";
Scope = "scope";
ScopeName = "scope.name";
ScopeResources = "scope.resources";
Token = "token";
TokenApplicationId = "token.application_id";
TokenAuthorizationId = "token.authorization_id";
TokenReferenceId = "token.reference_id";
TokenSubject = "token.subject";
TokenPrune = "token.prune";
})));
```
Services are *registered as Singleton* since `ICouchClient` is/should be registered as such and no other dependency is needed.
# LICENSE
The project is Licensed under the Apache-2.0 License see the [LICENSE](LICENSE.md) for more info.