18.13. 存储供应商操作


配置 Kerberos 存储供应商

  1. 针对 组件 端点使用 create 命令。
  2. 将 realm id 指定为 parentId 属性的值。
  3. 指定 kerberos 作为 providerId 属性的值,将 org.keycloak.storage.UserStorageProvider 指定为 providerType 属性的值。
  4. 例如:

    $ kcadm.sh create components -r demorealm -s parentId=demorealmId -s id=demokerberos -s name=demokerberos -s providerId=kerberos -s providerType=org.keycloak.storage.UserStorageProvider -s 'config.priority=["0"]' -s 'config.debug=["false"]' -s 'config.allowPasswordAuthentication=["true"]' -s 'config.editMode=["UNSYNCED"]' -s 'config.updateProfileFirstLogin=["true"]' -s 'config.allowKerberosAuthentication=["true"]' -s 'config.kerberosRealm=["KEYCLOAK.ORG"]' -s 'config.keyTab=["http.keytab"]' -s 'config.serverPrincipal=["HTTP/localhost@KEYCLOAK.ORG"]' -s 'config.cachePolicy=["DEFAULT"]'
    Copy to Clipboard Toggle word wrap

配置 LDAP 用户存储供应商

  1. 针对 组件 端点使用 create 命令。
  2. 指定 ldap 作为 providerId 属性的值,将 org.keycloak.storage.UserStorageProvider 指定为 providerType 属性的值。
  3. 提供 realm ID 作为 parentId 属性的值。
  4. 使用以下示例创建 Kerberos 集成的 LDAP 提供程序。

    $ kcadm.sh create components -r demorealm -s name=kerberos-ldap-provider -s providerId=ldap -s providerType=org.keycloak.storage.UserStorageProvider -s parentId=3d9c572b-8f33-483f-98a6-8bb421667867  -s 'config.priority=["1"]' -s 'config.fullSyncPeriod=["-1"]' -s 'config.changedSyncPeriod=["-1"]' -s 'config.cachePolicy=["DEFAULT"]' -s config.evictionDay=[] -s config.evictionHour=[] -s config.evictionMinute=[] -s config.maxLifespan=[] -s 'config.batchSizeForSync=["1000"]' -s 'config.editMode=["WRITABLE"]' -s 'config.syncRegistrations=["false"]' -s 'config.vendor=["other"]' -s 'config.usernameLDAPAttribute=["uid"]' -s 'config.rdnLDAPAttribute=["uid"]' -s 'config.uuidLDAPAttribute=["entryUUID"]' -s 'config.userObjectClasses=["inetOrgPerson, organizationalPerson"]' -s 'config.connectionUrl=["ldap://localhost:10389"]'  -s 'config.usersDn=["ou=People,dc=keycloak,dc=org"]' -s 'config.authType=["simple"]' -s 'config.bindDn=["uid=admin,ou=system"]' -s 'config.bindCredential=["secret"]' -s 'config.searchScope=["1"]' -s 'config.useTruststoreSpi=["always"]' -s 'config.connectionPooling=["true"]' -s 'config.pagination=["true"]' -s 'config.allowKerberosAuthentication=["true"]' -s 'config.serverPrincipal=["HTTP/localhost@KEYCLOAK.ORG"]' -s 'config.keyTab=["http.keytab"]' -s 'config.kerberosRealm=["KEYCLOAK.ORG"]' -s 'config.debug=["true"]' -s 'config.useKerberosForPasswordAuthentication=["true"]'
    Copy to Clipboard Toggle word wrap

删除用户存储供应商实例

  1. 使用存储供应商实例的 id 属性来编写端点 URI,如 components/ID
  2. 针对此端点运行 delete 命令。

    例如:

    $ kcadm.sh delete components/3d9c572b-8f33-483f-98a6-8bb421667867 -r demorealm
    Copy to Clipboard Toggle word wrap

为特定用户存储供应商触发所有用户同步

  1. 使用存储供应商的 id 属性来编写端点 URI,如 user-storage/ID_OF_USER_STORAGE_INSTANCE/sync
  2. 添加 action=triggerFullSync 查询参数。
  3. 运行 create 命令。

    例如:

    $ kcadm.sh create user-storage/b7c63d02-b62a-4fc1-977c-947d6a09e1ea/sync?action=triggerFullSync
    Copy to Clipboard Toggle word wrap

为特定用户存储供应商触发更改的用户同步

  1. 使用存储供应商的 id 属性来编写端点 URI,如 user-storage/ID_OF_USER_STORAGE_INSTANCE/sync
  2. 添加 action=triggerChangedUsersSync 查询参数。
  3. 运行 create 命令。

    例如:

    $ kcadm.sh create user-storage/b7c63d02-b62a-4fc1-977c-947d6a09e1ea/sync?action=triggerChangedUsersSync
    Copy to Clipboard Toggle word wrap

测试 LDAP 用户存储连接

  1. testLDAPConnection 端点上运行 get 命令。
  2. 提供查询参数 bindCredential,bindDn,connectionUrl, 和 useTruststoreSpi
  3. action 查询参数设置为 testConnection

    例如:

    $ kcadm.sh create testLDAPConnection -s action=testConnection -s bindCredential=secret -s bindDn=uid=admin,ou=system -s connectionUrl=ldap://localhost:10389 -s useTruststoreSpi=always
    Copy to Clipboard Toggle word wrap

测试 LDAP 用户存储身份验证

  1. testLDAPConnection 端点上运行 get 命令。
  2. 提供查询参数 bindCredential,bindDn,connectionUrl, 和 useTruststoreSpi
  3. action 查询参数设置为 testAuthentication

    例如:

    $ kcadm.sh create testLDAPConnection -s action=testAuthentication -s bindCredential=secret -s bindDn=uid=admin,ou=system -s connectionUrl=ldap://localhost:10389 -s useTruststoreSpi=always
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat