xurxodev
xurxodev

Reputation: 1837

ASP.NET Identity in Domain Driven Design Architecture

Hi I'm starting a project using DDD.

I would like to use Asp.Net Identity for user authentication but IdentityUser this very coupled to Asp.net and a domain model object should not have dependencies.

This is leading me to think that authentication may be a different BoundedContext that is not implemented using DDD.

I would like to know if anyone has been in the same situation and what options you think I can have.

thanks

Upvotes: 4

Views: 1434

Answers (1)

Machet
Machet

Reputation: 1110

For me it is fine to implement authentication without using DDD. DDD way is time consuming/expensive and it's fine to use it only to your core domain (code that has most business value).

And remember that if you want to separate yourself from frameworks you can always hide yourself behind Interface. In this case your business layer may declare IIdentityProvider with methods that your business layer require. Then you can provide concrete implementation of this provider AspIdentityProvider: IIdentityProvider in your website layer. Then AspIdentityProvider might be injected to classes in business layer that require it.

Upvotes: 3

Related Questions