CoreIdentityWithStores
Custom Implementation of IdentityRole, IdentityUser, RoleStore and UserStore
Install / Use
/learn @sasaman91/CoreIdentityWithStoresREADME
Custom storage providers for ASP.NET Core Identity
This project is writen in Net Core 2.2 framework and includes custom storage providers for ASP.NET Core Identity and you can use it with own Schema for Database and Classes with ASP.NET Core Identity and EF Core
This sample project includes implementation of :
- IdentityRole
- IdentityUser
- RoleStore
- UserStore
Can help you if you have your own classes for User and Role that doesn't inherit from Identity User.
You can use UserRole and UserStore to implement your own logic or if you want to use DbContextFactory with Identity.
Setup / Usage / How To
- Install MsSQL and Make Database
- Be sure to input correct MsSQL Connection String to the AppSettings pointing to the correct Database
- Run Commands for Migration to make tables to the MsSQL database:
Add-Migration InitialMigration
Then:
Update-Database
ASP.NET Core provides a number of optional interfaces you may choose implement.
IUserRoleStore IUserClaimStore IUserPasswordStore IUserSecurityStampStore IUserEmailStore IPhoneNumberStore IQueryableUserStore IUserLoginStore IUserTwoFactorStore IUserLockoutStore
You can implement all those interfaces in same way like I implemented: For UserStore: IUserPasswordStore, IUserEmailStore, IUserRoleStore, IUserClaimStore For RoleStore: IRoleStore, IRoleClaimStore
You can read more at: Custom storage providers for ASP.NET Core Identity
FAQ
- Do you loose features that comes with Identity (Password Hashing...)?
- No, you can use password hashing, cookie authentication, anti-forgery, roles, claims, and all the other features that come with Identity framework.
- Why I would use this approach when default Identity models are rich?
- One of the main reasons for this is that you maybe need just portion of Identity features, or you maybe have existing database Schema (Users, Roles...) that you cannot easily change or migrate to.
Collaboration
Feel free to collaborate on project and this sample project for Custom Storage providers. Cheers!
Related Skills
node-connect
340.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.2kCommit, push, and open a PR
