MarimerLLC / cslaforum

Discussion forum for CSLA .NET
https://cslanet.com
Other
31 stars 6 forks source link

ASP.NET Core Identity with CSLA #560

Open michaelcsikos opened 6 years ago

michaelcsikos commented 6 years ago

Question Are there any demos or recommendations for using Identity with CSLA? Identity puts the DAL, biz and UI all in the ASP.NET project, which kind of makes my left eye twitch. I've seen some attempts at separating it into separate projects, but it's not trivial. In most business apps, you would expect the user record to be linked to other tables, and ideally we should only be using one EF DbContext.

In .NET 4.6, there's a NuGet package https://www.nuget.org/packages/Microsoft.AspNet.Identity.Core which contains the core interfaces for ASP.NET Identity. It has no dependencies.

In .NET Core 2.1, the NuGet package seems to be https://www.nuget.org/packages/Microsoft.AspNetCore.Identity. It's not just the interfaces, and it depends on: Microsoft.AspNetCore.Authentication.Cookies Microsoft.AspNetCore.Cryptography.KeyDerivation Microsoft.AspNetCore.Hosting.Abstractions Microsoft.Extensions.Identity.Core

Any advice appreciated.

Version and Platform CSLA version: 4.7.100 OS: Windows, iOS, Android Platform: ASP.NET Core, Xamarin, etc.

rockfordlhotka commented 6 years ago

This is one of the primary roadblocks that has kept me from updating the ProjectTracker MVC app... The new Razor pages are very wonderful, and I love nearly everything about ASP.NET Core.

But this identity model just flies in the face of all past models, and I haven't wrapped my head around it...

At the end of the day all CSLA cares about is that there's a valid principal/identity pair available via HttpContext.Current.User. But I think the new identity stuff doesn't even maintain that value does it?

michaelcsikos commented 6 years ago

I'm glad I'm not the only one that sees the new Identity implementation as a roadblock. To me, Identity 3 seems to be less flexible than Identity 2.

From this question on StackOverflow I came across something called cloudscribe on GitHub which separates Identity into layers (and does a lot of other things). There's also JabbR-Core which is an example of just moving the Identity stuff to another project.

I would give my left arm for a bare-bones sample (or tutorial) that uses Identity, Razor Pages and Xamarin, following the recommended tiered approach.