-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Extensions.Identity.Core instead of AspNetCore.Identity #11
Conversation
Thanks. Will review soon. |
samples/Basic.Tests/TestHost.cs
Outdated
services | ||
.AddIdentity<AppUser, AppRole>() | ||
services.AddIdentityCore<AppUser>(_ => { }) | ||
.AddRoles<AppRole>() | ||
.AddUserStore<InMemoryUserStore<AppUser, AppRole>>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so. It's true that we don't need to depend on anything besides the Core package. But I guess apps will still probably use .AddIdentity<AppUser, AppRole>()
, right? So the samples will stay the same. And because our main project now drops the "Microsoft.AspNetCore.Identity" dependency, we should just add it in this sample instead, and revert this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that the default sample should still be AddIdentity, as it still seems to be the main use case. I could add an extra sample for Core use, but since the code is pretty much the same I don't think it's worth it.
AddIdentityCore will probably be used for apps that only provide REST API's, and don't need the web page part of the MVC package. That's where I'm using it for at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AddIdentityCore will probably be used for apps that only provide REST API's
That's what I needed to know. Haven't yet had the time to go deep into how things changed in 2.0 😅
Agreed. Another sample for usage with Core would be better, but it's also not that much needed. So feel free to do whatever is appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think I'll skip the additional sample then ;)
Changes are pushed.
samples/Basic/Startup.cs
Outdated
services.AddIdentity<AppUser, AppRole>().AddEntityFrameworkStores<AppDbContext>(); | ||
services.AddIdentityCore<AppUser>(_ => { }) | ||
.AddRoles<AppRole>() | ||
.AddEntityFrameworkStores<AppDbContext>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, just revert this change.
…ll serve as the main use case.
Thanks a lot! |
In AspNetCore 2.0 the Identity project has been split into 2 parts: AspNetCore.Identity and Extensions.Identity.Core.
ExtensionsIdentity includes all the base logic like users, userroles, their stores, validators, etc.
AspNetCoreIdentity includes additional logic like signing in (SignInManager), cookie authorization, etc.
It would be better to reference ExtensionsIdentity from this project, as we only require functionality that's part of this base.
I've tested building the project on my own machine after this change, and adding a reference to the local
MR.AspNet.Identity.EntityFramework6.dll
binary directly from my main project. Seems to work.