18.12. ストレージプロバイダー操作

Kerberos ストレージプロバイダーの設定

  1. components エンドポイントに対して create コマンドを使用します。
  2. レルム ID を parentId 属性の値として指定します。
  3. kerberosproviderId 属性値として指定し、org.keycloak.storage.UserStorageProviderproviderType 属性値として指定します。
  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"]'

LDAP ユーザーストレージプロバイダーの設定

  1. components エンドポイントに対して create コマンドを使用します。
  2. ldapproviderId 属性の値に、org.keycloak.storage.UserStorageProviderproviderType 属性値として指定します。
  3. レルム 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=["ldapsOnly"]' -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"]'

ユーザーストレージプロバイダーインスタンスの削除

  1. ストレージプロバイダーインスタンスの id 属性を使用して、components/ID などのエンドポイント URI を作成します。
  2. このエンドポイントに対して delete コマンドを実行します。

    以下に例を示します。

    $ kcadm.sh delete components/3d9c572b-8f33-483f-98a6-8bb421667867 -r demorealm

特定のユーザーストレージプロバイダーに対するすべてのユーザーの同期のトリガー

  1. ストレージプロバイダーの id 属性を使用して、user-storage/ID_OF_USER_STORAGE_INSTANCE/sync などのエンドポイント URI を作成します。
  2. action=triggerFullSync クエリーパラメーターを追加します。
  3. create コマンドを実行します。

    以下に例を示します。

    $ kcadm.sh create user-storage/b7c63d02-b62a-4fc1-977c-947d6a09e1ea/sync?action=triggerFullSync

特定のユーザーストレージプロバイダーに対する変更済みのユーザーの同期のトリガー

  1. ストレージプロバイダーの id 属性を使用して、user-storage/ID_OF_USER_STORAGE_INSTANCE/sync などのエンドポイント URI を作成します。
  2. action=triggerChangedUsersSync クエリーパラメーターを追加します。
  3. create コマンドを実行します。

    以下に例を示します。

    $ kcadm.sh create user-storage/b7c63d02-b62a-4fc1-977c-947d6a09e1ea/sync?action=triggerChangedUsersSync

LDAP ユーザーのストレージ接続性のテスト

  1. testLDAPConnection エンドポイントで get コマンドを実行します。
  2. クエリーパラメーター bindCredentialbindDnconnectionUrl、および 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=ldapsOnly

LDAP ユーザーのストレージ認証のテスト

  1. testLDAPConnection エンドポイントで get コマンドを実行します。
  2. クエリーパラメーター bindCredentialbindDnconnectionUrl、および 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=ldapsOnly