geebengs
geebengs

Reputation: 33

Implementing multiple users within Identity and Access Bounded Context in Domain Driven Design

I am developing a multi-tenant JobBoard Application using DDD approach. I have read to a great extent both the blue and red books. I have also read many articles on DDD online. However, I have not seen any easy-to-comprehend example on the implementation of the Identity and Access bounded context in this regard.

My application structure looks like this:

A tenant creates a JobBoard. A job board (which belongs to a tenant) has two users: Employer and Job Seeker.

I have two bounded context namely: Identity and JobBoard.

My question is what would be the best way to implement the Employer and JobSeeker User?

  1. Should I have both the Employer and JobSeeker as entities (Aggregates) within the Identity bounded context or

  2. Should I have a User Entity (Aggregate) within the Identity Bounded context and have both Employer and JobSeeker as Role types of a Role Value Object which will be an attribute of the User Class.

Thanks.

Upvotes: 2

Views: 776

Answers (2)

guillaume31
guillaume31

Reputation: 14070

Unless Employer and JobSeeker don't authenticate in the same way, or you have security restrictions that require the two to be separated, I would have a single User object.

As an aside, it is not necessarily worthwhile to implement your own Identity subdomain, or at least to do so with a full fledged DDD model - aggregates, entities, etc.

Upvotes: 0

Constantin Galbenu
Constantin Galbenu

Reputation: 17683

I would choose no. 2

Employer and JobSeeker seem to have a meaning only in the JobBoard Bounded Context so you should implement them as value objects in that BC, created based on the Role from Identity Bounded Context.

Upvotes: 0

Related Questions