hades200082 / template-app-infrastructure

MIT No Attribution
0 stars 0 forks source link

Made the identity layer more provider specific #24

Closed hades200082 closed 1 year ago

hades200082 commented 1 year ago

Given that we're mainly using Auth0 currently, and that we'd likely need to use Auth0's Auth & Management APIs in any project that uses Auth0 I've reworked the Infrastructure.Identity architecture.

  1. We will now have a dedicated folder/namespace in there for each identity provider we add. Only Auth0 for now.
  2. Added Auth0 API clients with optional ServiceCollectionExtensions methods for adding them to DI
  3. Added a ManagementApiClientFactory, used internally when adding the ManagementApiClient to DI The ManagementApiClient is added as a Transient service using a factory method. Each time the service is injected a new instance of the client will be created, but the token we fetch for use with those instances will be cached for its lifetime and refreshed automatically. There's a built-in 30-minute grace and, since the services are transient no one instance should exist for longer than that.
  4. Each identity provider we add will manage its own IOptions configuration.