jasontaylordev / CleanArchitecture

Clean Architecture Solution Template for ASP.NET Core
MIT License
16.78k stars 3.6k forks source link

Clean WebAPI Architecture #74

Closed iammukeshm closed 4 years ago

iammukeshm commented 4 years ago

1.Can I use this architecture for setting up the .NET Core API when using the API First Approach for my project? I really want to avoid the Angular part. Just a clean API.

2.Is it fine to install the aspnetcore.identity to the domain layer, as i want to move the ApplicationUser.cs to the Domain ? I want the API or IdentityServer4 to be responsible for authenticating users. So that i have it all central. is it recommended to move the ApplicationUser to the Domain/Core? I need to make api endpoints that returns access tokens, registers users, etc etc

3.Does it make sense to implement IdentityServer4 for this Approach? or should i stick to just Identity Core?

GFoley83 commented 4 years ago
  1. This project already does that, The Angular client app is just supplementary; if you don't want it, just delete the ClientApp directory and you're left with a Core Web API project.

  2. No it's not a great idea to make ApplicationUser a domain entity and there's already been quite a bit of discussion on this: https://github.com/jasontaylordev/CleanArchitecture/issues/71, https://github.com/jasontaylordev/CleanArchitecture/issues/58#issuecomment-584055887, https://github.com/jasontaylordev/CleanArchitecture/issues/30. Nine times out of ten, all you need to do is associate a domain entity with the current logged in user and to accomplish that, all you need to do is have your entity inherit from AuditableEntity as shown in https://github.com/jasontaylordev/CleanArchitecture/issues/58#issuecomment-584055887.

  3. ASP.NET Identity is a user store/identity management library, where as IdentityServer is an OpenID Connect provider. You can use one, or the other or both. This solution uses both.

fawadtayyab123 commented 4 years ago

@GFoley83 kindly guide me if I delete ClientApp and connect another client from I want to authenticate and authorize the users. How would i do that ? Please guide me. Actually I already have an angular project built and I want to connect that project to this clean architecture.Thanks

GFoley83 commented 4 years ago

See my answer in https://github.com/jasontaylordev/CleanArchitecture/issues/79#issuecomment-595460333