如何使用 micronaut 实现基于模式的多租户

问题描述 投票:0回答:0

我开始构建一个新的 web 应用程序,它目前有一个

AuthenticationProvider
检查用户和密码是否与数据库表中的匹配。它基于会话。

目前 micronaut 似乎只使用公共模式(我在 postgres 上)。

我已经尝试在我的

application.yml
中启用子域租户解析器:

  data:
    multi-tenancy:
      mode: SCHEMA
      tenantresolver:
        subdomain:
          enabled: true

但我看不出它在做什么。如果我访问

subdomain.localhost
来测试它,会话 cookie 似乎与该子域相关联,但来自公共模式的任何用户都可以对其进行身份验证。我假设我的
AuthenticationProvider
需要以某种方式成为租户意识?

如果我让另一个租户注册,但他在注册时没有经过身份验证,那么在他们进行身份验证之前,如何使用 micronaut 数据为他们填充模式?谢谢。

java postgresql security multi-tenant micronaut
© www.soinside.com 2019 - 2024. All rights reserved.