Keycloak KeyClope:通过CLI创建用户时未分配角色
运行以下命令以导入具有角色的用户Keycloak KeyClope:通过CLI创建用户时未分配角色,keycloak,redhat-sso,Keycloak,Redhat Sso,运行以下命令以导入具有角色的用户 ./kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password [pass] ./kcadm.sh create users -r [realm_name] -f user-admin.json user-admin.json看起来像: { "username": "adminLocal", "enable
./kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password [pass]
./kcadm.sh create users -r [realm_name] -f user-admin.json
user-admin.json看起来像:
{
"username": "adminLocal",
"enabled": true,
"totp": false,
"emailVerified": false,
"firstName": "admin",
"lastName": "local",
"email": "adminLocal@domain.com",
"disableableCredentialTypes": ["password"],
"requiredActions": [],
"notBefore": 0,
"access": {
"manageGroupMembership": true,
"view": true,
"mapRoles": true,
"impersonate": true,
"manage": true
},
"credentials" : [
{
"value" : "secret",
"type" : "password",
"temporary" : false
}
],
"realmRoles" : ["admin","offline_access","uma_authorization"]
}
需要分配“realmRoles”键中的所有指定角色。不过,只将领域默认角色:“脱机访问”、“uma\u授权”
分配给了用户。
这些角色已经存在,并且是通过KeyClope管理UI预先添加的
可以创建用户,然后分配角色作为解决方法。然而,我想用一个命令来完成它