How does your domain know your user?

The article discusses the importance of separating user identity and authorization in business applications. It proposes using two abstractions: IIdentity for identifying who a user is and IPrincipal for determining what actions they can perform. This separation allows for more flexibility and accuracy in business logic. To implement this, developers can create concrete classes for UserIdentity, SystemIdentity, AnonymousIdentity, UserPrincipal, SystemPrincipal, and AnonymousPrincipal, and use them in command handlers like DeleteEmployeeCommandHandler.

Source →
FeedLens — Signal over noise Last 7 days