将 Auth Token 与多个 RESTheart 实例一起使用

Using Auth Token with multiple RESTheart Instances

我想知道如何在具有多个 RESTheart 实例的情况下使用 Auth Token。目前我们有多个实例部署到 kubernetes 并使用入口定义使它们可用。我们不想使用粘性会话来使用所有实例。

关于文档 https://restheart.org/learn/clients-authentication/,我们也可以使用 username:password 发送基本验证。但是尽管如此,我们想知道如何实现您在那里提到的分布式身份验证令牌缓存。有这方面的例子吗?或者有什么提示吗?

此致, 克里斯蒂安

如文档中所述:

Pay attention to the authentication token in case of multi-node deployments (horizontal scalability). In this case, you need to either disable it or use a load balancer with the sticky session option or use a distributed auth token cache implementation (not yet available in the current version but you can ask for support).

jira 项目的任务是https://softinstigate.atlassian.net/browse/RH-51:

RESTHeart makes use of caches for different purposes (e.g. db and collection properties, db based IDM, session token authentication). These are usually implemented using guava cache.

These are local caches that might pose issues in clustered deployments. We need to allow specifying the actual cache implementation via configuration.

We can then have different implementations:

  • local guava cache
  • a distributed cache (for instance, implementing the JCache specs)
  • a cache that sync data between different instances via a mongodb collection. note that from mongo v3.6 change stream allows notification of data changes