keycloak - Keycloak 需要数据库吗

标签 keycloak keycloak-services

我已将 Keycloak 设置为 SAML 代理,身份验证由当局提供的外部 IdP 完成。使用此 IdP 登录的用户都被接受,我们需要从 Keycloak 获得一个 OAuth token 来访问我们的系统。
我已经尝试过使用 H2 的默认设置并使用外部 MariaDB 运行。
外部 IdP 为我们提供了用户的全名和个人 ID。 GDPR 涵盖了这两个数据,我真的不喜欢将这些数据存储在 DMZ 中运行的数据库中的声音。开放Keycloak 访问后端数据库也不是一个好的解决方案,尤其是当我不需要存储用户时。
在没有数据库的情况下运行的好处是我有一个更简单的 DMZ 设置,因为我真的不需要在后端存储任何关于用户的信息。
我是否需要数据库,如果不需要,我如何在没有它的情况下运行 Keycloak?

最佳答案

Do I need a database, and if not how do I run Keycloak without it?


是的,但是,开箱即用的 Keycloak 无需部署任何外部数据库即可运行。来自 Keycloak 官方文档部分 Relational Database Setup可以阅读:

Keycloak comes with its own embedded Java-based relational database called H2. This is the default database that Keycloak will use to persist data and really only exists so that you can run the authentication server out of the box.


所以开箱即用的你不能在没有数据库的情况下运行 Keycloak。
从同一份文档中可以看出:

We highly recommend that you replace it with a more production ready external database. The H2 database is not very viable in high concurrency situations and should not be used in a cluster either.


所以关于这个:

The benefit running without a database is that I have a simpler DMZ setup as I really do not need to store anything about the users but on the backend.


您仍然最好提供部署另一个数据库,因为 Keycloak 在数据库中存储的不仅仅是用户信息(例如,领域信息、组、角色等)。

The external IdP provides us with a full name of the user and a personal ID. Both data are covered by GDPR and I really do not like the sound of storing that data in a database running in the DMZ. Opening up for Keycloak to access a database in the backend is also not a good solution, especially when I do not need users to be stored.


您可以将 IDP 和 Keycloak 配置为在用户进行身份验证时不会将用户导入 Keycloak。

关于keycloak - Keycloak 需要数据库吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66801793/

相关文章:

keycloak - 如何禁用 Keycloak 中的 SSO 功能

keycloak - ABAC with keycloak - 在策略中使用资源属性

curl - 在 Keycloak 上创建一个用户,包括来自 curl 命令的密码

keycloak - 新添加的realm管理员无法登录Keycloak中的realm

node.js - 如何限制刷新 token 的使用时间为 1 小时

authentication - 使用电话号码功能登录

java.lang.IllegalStateException :Current user principal is not of type when i try to integrate keycloak with spring boot web + spring security project

java - Quarkus 中的 Keycloak 管理客户端 - java.lang.InknownClassChangeError

asp.net - ASP.NET Core 的 Keycloak 客户端

Keycloak 17 : Unsatisfied dependency for type org. keycloak.models.KeycloakSession 和限定符 [@Default]