OfficialSPIUser Storage / FederationStale
Keycloak-PII-Data-Encryption-Provider
MLukman/Keycloak-PII-Data-Encryption-Provider ↗
Encrypt PII user attributes at rest.ユーザー属性(個人情報)を暗号化して保存
- ★
- 39
- Forks
- 9
- Contributors
- 3
- Updated
- 2025-09-02
- KC
- 26.3.3
- License
- Apache-2.0
What it can doできること4
- Encrypt username, email, first and last name at rest in the database (e.g. for GDPR), decrypting transparently on load.ユーザー名・メール・姓名をDB上で暗号化して保存し(GDPR対策など)、読み込み時に透過的に復号
- Extend encryption to custom attributes via a
pii-data-encryptionvalidator, or automatically for attributes starting withpii-.pii-data-encryptionバリデータを付けた独自属性や、pii-で始まる属性も自動で暗号化 - Enable it realm by realm from a custom "User Entity Encryption" tab.独自の「User Entity Encryption」タブで、realmごとに有効化できる
- Keep exact-match search working through stored hashes.ハッシュを保存しているので、完全一致の検索は引き続き使える
What it cannot do / limitsできないこと・制約5
- Fuzzy/partial search on encrypted fields is no longer possible.暗号化したフィールドでは、あいまい検索や部分一致検索ができなくなる
- Unmanaged user-profile attributes are not supported.ユーザープロファイルのunmanaged属性には対応していない
- If decryption fails, users and clients see the raw hash values.復号に失敗すると、ユーザーやクライアントにはハッシュ値がそのまま表示される
- Adding the validator to an existing attribute only encrypts existing data when the user is updated or encryption is toggled off and on.既存の属性にバリデータを追加しても、既存データが暗号化されるのはユーザー更新時か、暗号化を一度オフ→オンにしたときだけ
- Without
KC_PII_ENCKEYthe key falls back to an MD5 of the JDBC URL, which breaks if the database URL changes.KC_PII_ENCKEYを設定しないと、鍵はJDBC URLのMD5になる。DBのURLが変わると復号できなくなる
Requirements前提条件
- Keycloak 24+ with the
declarative-uifeature,KC_PII_ENCKEY(16+ characters), and thepii-data-encryptionevent listener enabled per realm.declarative-ui機能を有効にしたKeycloak 24以上、KC_PII_ENCKEY(16文字以上)、realmごとのpii-data-encryptionイベントリスナーの有効化