获取令牌成功:
Post: http://localhost:8180/auth/realms/public-library/protocol/openid-connect/token
Content type:application/x-www-form-urlencoded
Body:x-www-form-urlencoded
client_id:spring-boot-app
username:pooja.kumawat
password:poojakumawat@23
grant_type:password
Output:Token
创建用户时遇到错误:
Post : http://localhost:8180/auth/public-library/users
Authorization:Bearer+Token
Content type:Application/Json
Body:Raw
{
"username": "name",
"enabled": true,
"emailVerified": false,
"firstName": "first",
"lastName": "last",
"credentials": [
{
"type": "password",
"value": "newPas1*",
"temporary": false
}
]
}
错误是:
{
"error": "RESTEASY003210: Could not find resource for full path: http://localhost:8180/auth/public-library/users"
}
答案 0 :(得分:0)
您似乎使用了错误的端点,将其更改为
http://localhost:8180/auth/admin/realms/public-library/users
请记住,正在执行POST
请求的用户至少需要分配manage-users
领域管理角色。否则,响应将为403禁止
答案 1 :(得分:0)
您需要做的是转到密钥斗篷中使用的领域。然后转到“用户”部分,然后选择用于请求的用户。在角色映射下,选择领域管理并为此用户分配角色领域管理员和管理用户角色。之后,您将可以发出请求