How to decouple Identity from Domain Layer? #415
Replies: 1 comment 9 replies
-
Not at all claiming this is the right way to go but... I've been going back and forward with this a lot myself recently and I came to the conclusion that I should use identity framework for two things only and then keep it as a completely separate entity in the system I am writing:
I have my own internal user class which is the only part of the system that references an Identity User ID (via a I felt comfortable doing things this way because in my mind, Identity Server is a separate thing outside the scope of my application, I wanted to keep it as separate as possible. I effectively don't care about any Identity based data for a user, it's none of my business, I just want to use it to allow a user to prove who they are. I use Authorization to define some very simple roles which basically set the type of user each entity is and with it which pages in the system they can see, however for my project a lot of the access logic is business driven, so I keep that within the domain and nothing to do with Identity Server. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Would love to hear some opinions on this subject. It's one of the most present topics in this architecture, but never properly explained. Found a project based on this architecture that uses automapper to "sync" a custom User class to IdentityUser user entity but is this the best approach?
https://github.com/mmacneil/CleanAspNetCoreWebApi
It would be nice to see how CleanArchitecture deals with:
Beta Was this translation helpful? Give feedback.
All reactions