sephnescence / laravel-inertia-react-pkm

A project to explore personal knowledge management in an all in one - with Laravel/Inertia/React instead of NextJS or Remix
0 stars 0 forks source link

Multi tenency #3

Open sephnescence opened 1 month ago

sephnescence commented 1 month ago

I haven't started coding anything yet, but I've got a few thoughts on the matter

sephnescence commented 1 month ago

A thought with authentication servers in mind. We have the choice of making them sign up on a global site, or on an already provisioned site, e.g. .saas.com. Depending on the way your application is built, the multi tenant schema might not already exist. So the authentication server might have to handle signing up and triggering an event to provision the schema. There might even be a combination of both. e.g. for Slack - The workspace owner would trigger this initial step, configure payment options, etc., and ultimately allow other users to be provisioned within the tenant

If a user signs up from say localhost/register, the authentication server can emit an event to the schema provisioning service, which emits an event back to the authentication server to let it know what tenant that username belongs to. To kind of cover up the time it takes to do this, just do the typical email verification step - It's good security practice anyways. I believe locally there's a mailtrap interface

The new schema can have the same name as the user's uuid or something. Will be pretty clean for handling GDPR as we can just delete the schema. However, it means that we'll have to take care of authenticating a user when we don't necessarily know which tenant they are in. Do we have the application server emit an event to the authentication server saying that this username belongs to this tenant? So when the user logs in, the authentication server knows which tenant they are?

This should be hooked up with Event Bridge etc.