atm0s-media-server icon indicating copy to clipboard operation
atm0s-media-server copied to clipboard

feat: multi tenancy

Open giangndm opened this issue 1 year ago • 2 comments

Description

This PR introduce multi tenancy feature. The original idea is from token generate step, instead of provide configured secret, we can have a list of apps with separated secret which can be pulled from other sources (like control panel).

I created a AppContext for each session for providing more custom behavior in future (now it only have app_id).

Logic:

  • Token need to be build with app context inside. With JWT we use subject for store app_id.
  • At the core, cluster only see anything is some peer or track inside a room hash, which generated from both app_id and room

Depend on node-types, we have difference mechanism:

  • Gateway: sync app lists, validate secret and create token with main secret
  • Connector: sync app lists, build record or send hooks based on app config
  • Media: only use main secret to validate

Related Issue

If this pull request is related to any issue, please mention it here.

Checklist

  • [x] Cluster logic
  • [x] Log logic (connector, hooks, ...)
  • [x] Record logic
  • [ ] Custom hooks endpoint for each app
  • [x] I have tested the changes locally.
  • [x] I have reviewed the code changes.
  • [x] I have updated the documentation, if necessary.
  • [x] I have added appropriate tests, if applicable.

Screenshots

If applicable, add screenshots to help explain the changes made.

Additional Notes

Add any additional notes or context about the pull request here.

giangndm avatar Sep 29 '24 08:09 giangndm