I'm starting to build a new webapp, it currently has an AuthenticationProvider
which checks a user and password match what's in a database table. Its session based.
Currently micronaut just seems to use the public schema (I'm on postgres).
I've tried enabling a subdomain tenant resolver in my application.yml
:
data:
multi-tenancy:
mode: SCHEMA
tenantresolver:
subdomain:
enabled: true
But I can't tell that it's doing anything. If I visit subdomain.localhost
to test it a session cookie seems to appear tied to that subdomain, but any user from the public schema can authenticate against it. I assume my AuthenticationProvider
needs to become tenant aware somehow?
If I then have another tenant sign up, who isn't authenticated at the point of registering, how would a schema get populated for them using micronaut data before they come to authenticate? Thanks.
In case it helps anyone else, I had two issues:
proxy_set_header Host $host;
setting, else it was taking the subdomain from host.docker.internal which was always consistent and not from abc.myhost.com
or xyz.myhost.com
etc.application.yml
should be under multitenancy which sits on the same level as data.