我想使用api创建用户,但在为用户设置领域角色时遇到问题。
http://localhost:8180/auth/admin/realms/microservicedb/users
{
"username": "abc3",
"email": "ab3@gmail.com",
"realmRoles": [
"admin", "employee"
],
"credentials": [{
"type": "password",
"temporary": true,
"value": "testpass"
}],
"enabled": true
}
尝试使用此api时,将成功创建用户,但是领域角色中自定义创建的角色“ admin”和“员工”角色未映射到用户。
{
"username": "roletest",
"email": "roletest@gmail.com",
"realmRoles": [
"5bb0da62-86e4-4f90-b349-fcec4f3ac8b9", "31d0879d-ff8f-48cf-adb6-a9c996887ba4"
],
"credentials": [{
"type": "password",
"temporary": true,
"value": "testpass"
}],
"enabled": true
}
尝试使用具有角色ID的方法,但结果相同 用户创建时没有自定义realmRole映射