使用管理控制台 API 在 keycloak 中导出具有凭据的用户

Export users with credential in keycloak with Admin Console API

如何使用管理控制台在 keycloak 中导出具有凭据的用户API
我使用了这个端点,但它不包含用户的凭据
curl -X GET https://$KEYCLOAK_IP/auth/admin/realms/$REALM_NAME/users

这是端点不包含凭据的结果

 {
    "id": "dbede89b-dbf8-4b4b-84a6-da7b6c1877e3",
    "createdTimestamp": 1607591201217,
    "username": "admin",
    "enabled": true,
    "totp": false,
    "emailVerified": false,
    "disableableCredentialTypes": [],
    "requiredActions": [],
    "notBefore": 0,
    "access": {
        "manageGroupMembership": true,
        "view": true,
        "mapRoles": true,
        "impersonate": true,
        "manage": true
    }
},

如何使用凭据恢复用户?

不,单独使用该端点 不会return 您支持用户凭据。但是,您可以使用端点导入具有凭据的用户:

PUT https://$KEYCLOAK_IP/auth/admin/realms/$REALM_NAME/users

要导出用户及其密码,您可以在 keycloak 启动期间传递选项 -Dkeycloak.migration.action=export

bin/standalone.sh -Dkeycloak.migration.action=export

与导入类似,只需使用 -Dkeycloak.migration.action=import

您可以在 Red Hat documentation and/or in this blog

上阅读有关此选项的更多详细信息