如何通过keycloak API为用户设置所需的操作?我在他们的管理休息 API 文档中没有找到它。只有
PUT /{realm}/users/{userId}/execute-actions-email
但它通过电子邮件工作,这不符合我的要求。我想强迫用户 在下次登录时配置 OTP。 谁能告诉我
{userId}
之后的网址应该是什么
我已经尝试过这个网址
PUT /{realm}/users/{userId}/settings
但这对我不起作用。
REST API
PUT /{realm}/users/{userId}
Payload
{
"id": {user id},
"username": {user name},
"email": {user email},
"emailVerified": false,
"createdTimestamp": {Epoch & Unix Timestamp},
"enabled": true,
"totp": false,
"disableableCredentialTypes": [],
"requiredActions": [
"CONFIGURE_TOTP"
],
"notBefore": 0,
"access": {
"manageGroupMembership": true,
"view": true,
"mapRoles": true,
"impersonate": true,
"manage": true
},
"attributes": {},
"firstName": {first name},
"lastName": {last name}
}
示例
{
"id": "0baf6148-01f1-4bad-a781-da1bfd36d234",
"username": "user1",
"email": "[email protected]",
"emailVerified": false,
"createdTimestamp": 1731062915931,
"enabled": true,
"totp": false,
"disableableCredentialTypes": [],
"requiredActions": [
"CONFIGURE_TOTP"
],
"notBefore": 0,
"access": {
"manageGroupMembership": true,
"view": true,
"mapRoles": true,
"impersonate": true,
"manage": true
},
"attributes": {},
"firstName": "",
"lastName": ""
}
user actions list
VERIFY_EMAIL, UPDATE_PROFILE, CONFIGURE_TOTP, UPDATE_PASSWORD, TERMS_AND_CONDITIONS