Decoupling ASP.NET Identity from the Core Domain Models - Onion Architecture

后端 未结 3 1791
清歌不尽
清歌不尽 2021-02-01 10:03

I am using this sample project (https://github.com/imranbaloch/ASPNETIdentityWithOnion) as my application architecture, in this sample the core is completly decoplied from the i

3条回答
  •  滥情空心
    2021-02-01 10:43

    Just stumbled upon this, having the same problem.

    The problem with the marked answer is that it still references Microsoft.AspNet, which makes it rough for future .NET Core-plans.

    The main problem is really with the general attempt to build in an authentication feature in the core, which defeats the purpose.

    Consider letting the built in functionality for web authentication and authorization remain in the web layer, and reference a Core user object (UserProfile?) that represents the Core needs. This would also simplify switching to another authentication method (AD).

    Depending on your preference, you can then reference the Core.UserProfile from your AspNetUser to avoid multiple SQL-calls, or simply make sure to have a good cache policy on the Core.UserProfile operations.

    This allows you to control your authentication methods separate from your Core model.

提交回复
热议问题