Example of custom membership system using ASP.NET Identity 2, ASP.NET Web API 2 and OWIN Bearer token authentication
The AspNetIdentity.WebApi is an HTTP ASP.NET WebApi 2 service which acts as back-end for SPA frontend AspNetIdentity.Angular built using Angular 5.
Default users with passwords (e.g SuperPowerUser) are created in AspNetIdentity.WebApi.Migrations.Configuration.CreateUsers
Implementation for the custom Microsoft.AspNet.Identity.UserManager
with own custom database entities:
XUser
with custom columnsXRole
XUserRole
XLogin
XClaim
- managers:
XUserManager
andXRoleManager
EntityFramework entities are mapped to custom database tables.
OAuth 2.0 Bearer Access Token generation and consumption is implemented in Startup.Auth.cs
mainly by
Identity\Providers\CustomOAuthProvider.cs
Identity\Providers\JwtTokenFormat.cs
Identity\Providers\RefreshTokenProvider.cs
The app was generated with angular-cli and can be run by npm install
and then npm start
and is hosted on http://localhost:4200/