There should be multiple layers for identity. The actual ui will be in the UI layer, but you will have adapters to convert to poco entities that can be passed to business rule layer, which will implement the access rules.
Layers in Clean Architecture Asp.net Core 5
Hi,
this my layers in clean architecture , see the photo
1.Is this clean architecture observed?
2. i want add identity to project , Which layer should I add identity (authentication) to?
2 answers
Sort by: Most helpful
-
-
Bruce (SqlWork.com) 56,771 Reputation points
2021-11-30T17:32:30.873+00:00 you appear to be using DI with repository pattern, this is slightly different than clean. in clean,
entity (domain) layer: poco objects with with localized validation rules (formatting etc)
use cases (business) layer: business logic that performs actions on entities
controllers layer: adapters to access services like a database databases,
external layer: ui, rest api, etcthe logic for a use case is:
- map request data to entity
- call adapters get an external data
- call use case logic
- map use case response to external data
an external layer action may require multiple use cases. for example update name in a user record:
validate access
- map request to security request
- call adapter to get user record security object
- call business rule to valid access
do name change
- map request to name change object
- call adapter to read user entity
- call business rule apply name change to user entity
- call adapter to save user entity
return result
- map to response