Skip to content
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

Merged
merged 2 commits into from
Aug 21, 2017

Conversation

nphmuller
Copy link
Contributor

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.

@mrahhal
Copy link
Owner

mrahhal commented Aug 21, 2017

Thanks. Will review soon.

services
.AddIdentity<AppUser, AppRole>()
services.AddIdentityCore<AppUser>(_ => { })
.AddRoles<AppRole>()
.AddUserStore<InMemoryUserStore<AppUser, AppRole>>()
Copy link
Owner

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.

Copy link
Contributor Author

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.

Copy link
Owner

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.

Copy link
Contributor Author

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.

services.AddIdentity<AppUser, AppRole>().AddEntityFrameworkStores<AppDbContext>();
services.AddIdentityCore<AppUser>(_ => { })
.AddRoles<AppRole>()
.AddEntityFrameworkStores<AppDbContext>();
Copy link
Owner

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.

@mrahhal mrahhal merged commit 7ee5744 into mrahhal:master Aug 21, 2017
@mrahhal
Copy link
Owner

mrahhal commented Aug 21, 2017

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants