DocumentDb Identity Provider for ASP.NET Core

I am trying to provide authorization to the user using DocumentDb on the backend - But I can not find any resources regarding the same. Documentation provided for SQL-based ( https://docs.asp.net/en/latest/security/authentication/identity.html ).

Any help?

+6
source share
3 answers

To provide you with a starting point, there are several important issues to keep in mind when using Identity with the ASP.Net kernel:

Frame compatibility

You mentioned that you will use ASP.Net Core, and this can be used with either the .Net Core or the full '.Net Framework (e.g. .Net Framework 4.5.1), which can be specified in your project.json property frameworks .

Microsoft. DocumentDB custom .Net client does not support .Net Core; therefore, you must configure ASP.Net Core to install the "full .Net Framework." If you do not know how to do this, you can create a new project in Visual Studio 2015 and select the project template "ASP.Net Core (.Net Framework)"; project.json will have the framework property properly configured for you.

Identity Version

There are several versions of ASP.Net Identity; remember when choosing a provider that currently refers to an ASP.Net 2.2.1 identifier; however, the latest version 3 , released with ASP.Net Core, is supported by the Microsoft.AspNetCore.Identity 1.0.0 NuGet package, which has some differences and additional features. (Note that this latest package can be used with the full .NET Framework.)

Official implementation

Microsoft decided not to create an official implementation of DocumentDB for ASP.Net Identity, citing the fact that "there are two communities available" (link here )

third party support

Of the available third-party implementations, this Adrian Fernandez is the most widely used one that provides support for ASP.Net Identity 3 using Microsoft's own DocumentDB client. Samples are included in the GitHub repository. ( See below for more details. )

Usage example

An example of using this DocumentDB provider with ASP.Net, including additional features, can be found here .

An additional example of using ASP.Net Core with the Microsoft DocumentDB provider can be found here .

I wrote my own Identity 3 provider for DocumentDB; if I release this on GitHub, I will update this answer with a link.

UPDATE 04/19/2017

For those who are looking for a solution, I now recommend Bernhard Koenig's AspNetCore.Identity.DocumentDb project. It is fully functional, includes unit tests and a sample ASP.Net Core project. Also available through Nuget. It supports netstandard1.6 an net46 .

+18
source

I understand that Microsoft made it possible to use Mongo drivers with DocumentDb, so perhaps you could use this Mongolian implementation to identify the asp.net core

or google for further work that others could do in this direction.

To implement it yourself, you will need to implement a minimum of IUserStore and IRoleStore; you can also refer to the EF UserStore and RoleStore implementations for inspiration and recommendations for their implementation.

+1
source

The best solution would be to use the DocumentDB provider for the .NET Core Identity platform. But so far they have not been, so I created AspNetCore.Identity.DocumentDB and decided to publish it on GitHub under the MIT license.

This is the port of the existing mongodb provider for .NET Core Identity and saves tickets, tokens, and logins as nested objects. Although you can use DocumentDB with the mongodb interface, it is recommended that you use your own SDK whenever possible.

The library is already pretty stable and available as a NuGet package.

Note: The DocumentDB SDK for C # itself does not support .NET Core as the target platform in a stable release. Fortunately, Microsoft is already working on adding support for .NET Core and has published a preview of the DocumentDB SDK with NET NET support in Connect (); 2016. AspNetCore.Identity.DocumentDB supports both SDKs.

The .NET Standard is an API specification that should be available in all .NET environments and is currently supported by the .NET Core and .NET Framework.

0
source

All Articles