Konrad Początek
Konrad Początek

Reputation: 354

Keycloak - import password policy

I've set up a password policy

enter image description here

After export everything I've got a json with line:

"passwordPolicy": "upperCase(1)"

But after import the password policy is no longer visible and export does not contain this line.

The question is how to write json file, so I can import this policy?

Upvotes: 0

Views: 1026

Answers (2)

dreamcrash
dreamcrash

Reputation: 51393

Alternatively, you can do it by calling the Rest Endpoint:

PUT https://<KEYCLOAK_IP>/auth/admin/realms/<YOUR_REALM>

the json contend {"realm:"YOUR_REALM", "passwordPolicy":"upperCase(1)"}

or using Keycloak Admin CLI, for instance

./kcadm.sh update realms/<your_realm> -f example.json

with the content of example.json being {"realm:"YOUR_REALM", "passwordPolicy":"upperCase(1)"}

Upvotes: 1

Konrad Początek
Konrad Początek

Reputation: 354

The solution which suits for me, but maybe not for everyone, is to recreate docker with parameter: keycloak.migration.file pointing to that exported file. Then the password policy is created correctly.

It looks like import feature is not using every field of exported file.

Upvotes: 0

Related Questions