Comments (5)
Please help ???
from northwindtraders.
@CodeRapp3r, please follow this link below. This will help you replacing InMemory and using IdentityServer4 with Entity Framework
link
from northwindtraders.
thank you it resolve 5 th point
But really dot understand where i install Identityserver4.Entityframework package in Northwind.Persistence or Northwid.identityServer project
from northwindtraders.
@CodeRapp3r In order to implement IdentityServer4 and Entity Framework, I suggest you to start with the basic not to implement the code for NorthWindTrader. The basic IdentityServer implementation has 2 parts, IdentityUser and IdentityRole. You inherit the IdentityUser for your YourCustomUser. Create new project using VisualStudio/VSCode/ your terminal. Create YourCustomUser class and implement:
public class YourCustomUser : IdentityUser { public YourCustomUser() : base() { } public YourCustomUser(string userName) : base(userName) { } public YourCustomUserProperty YourCustomUserProperty { get; set; } }
Then, in your YourDbContext, you need to use IdentityDbContext instead of DbContext.
public class YourDbContext : IdentityDbContext<YourCustomUser> { public YourDbContext(DbContextOptions<YourDbContext> options) : base(options) { } public DbSet<YourCustomUser> YourCustomUsers { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); //Custom model builder here } }
Once you do this, this will use AspNetUser includes with your custom properties
Then in your StartUp.cs
Add this code below to your ConfigureServices
services.AddDbContext<YourDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity<YourCustomUser, IdentityRole>() .AddRoles<IdentityRole>() .AddDefaultUI() .AddRoleManager<RoleManager<IdentityRole>>() .AddDefaultTokenProviders() .AddEntityFrameworkStores<YourDbContext>();
Then in your Configure method, use
app.UseAuthentication();
from northwindtraders.
Thank You
from northwindtraders.
Related Issues (20)
- Consistent naming for behaviors HOT 1
- Why is CQRS put in Application and not in WebUI? HOT 2
- Do non-entities core models belong to the domain? HOT 2
- Use ProblemDetails/ValidationProblemDetails etc for exception middleware
- Use ProblemDetails/ValidationProblemDetails etc for exception middleware? HOT 1
- How can we write unit test cases for controllers extending base controller as we are not using constructor injection. any leads will be appreciated. HOT 1
- What's the point of having the IDateTime interface? HOT 2
- FromSqlRaw won't work in Application HOT 2
- ValueObject.Equals bug when objects have a different number of values HOT 1
- [Question] Should JWT/RefreshToken creation be on infrastructure? HOT 1
- [Discussion] Clean Architecture - is it really? HOT 4
- Why does it not look like shown in the XAML ControlsGallery App - DataGrid HOT 4
- Dealing with duplication HOT 6
- Application layer access to DbContext? HOT 2
- A better way to do upsert HOT 1
- Suggestion: Request with record type
- something similar HOT 1
- IDbContext and repository pattern HOT 1
- How to call stored procedure for CURD operation? HOT 1
- This repo is pretty old and the projects don't event load in VS 2022 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from northwindtraders.