Skip to content

goto10hq/Oogi2.AspNetCore.Identity

Repository files navigation

Oogi2.AspNetCore.Identity

Oogi2.AspNetCore.Identity

Software License Latest Version on NuGet NuGet Visual Studio Team services .NETStandard 2.0

ASP.NET Core Identity with DocumentDB (CosmosDB) as database layer. It is powered by Oogi2.

Configuration

public void ConfigureServices(IServiceCollection services)
{
 var connection = new Connection
 (
  Configuration["endpoint"], 
  Configuration["authorizationKey"], 
  Configuration["database"], 
  Configuration["collection"]
 );
 
 services.AddSingleton<IConnection>(connection);

 services.AddIdentity<ApplicationUser, ApplicationRole>()
 .AddDocumentDbStores()
 // I've prepared Czech localization
 //.AddErrorDescriber<CzechIdentityErrorDescriber>()
 // And English which is not needed... just for kicks
 //.AddErrorDescriber<EnglishIdentityErrorDescriber>()
 .AddDefaultTokenProviders();
}

If you don't need any own properties for user/role, you can just use IdentityUser and IdentityRole. In our example we extended them with some funky properties:

[EntityType("entity", "oogi2/user")]
public class ApplicationUser : IdentityUser<ApplicationRole>
{
 public int NumberOfNumbers { get; set; }
}

[EntityType("entity", "oogi2/role")]
public class ApplicationRole : IdentityRole
{
 public bool IsClever { get; set; }
}

If you wanna know more about EntityType attribute, check Oogi2.

And voila... that's all. EZPZ.

Acknowledgement

Based on AspNetCore.Identity.DocumentDb by codekoenig

License

MIT © frohikey / Goto10 s.r.o.

About

ASP.NET Core Identity for DocumentDB based on Oogi2.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages