Git Product home page Git Product logo

couchdb-openiddict's Introduction

P41.OpenIddict.CouchDB

Release NuGet License

CouchDB store provider for the Openiddict using CouchDB.NET.

The project was insipired from the existing OpenIddict 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 database must implement the ddoc.json in the ddocs folder.

At your Startup.cs add your ICouchClient in DI and use the following code.

// 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.

// 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 fodler.

services.AddIdentity<CouchDbUser, CouchDbRole>()
        .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 for more info.

couchdb-openiddict's People

Contributors

panoukos41 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.