Keycloak HTTP Admin 管理接口
Keycloak About 1,432 words生成 token
POST /realms/{realm}/protocol/openid-connect/token
使用admin-cli
这个client
,对应的realm
为master
,获取token
。
/realms/master/protocol/openid-connect/token
参数
client_id=admin-cli&grant_type=password&username=admin&password=admin
获取所有 realm
GET /admin/realms
返回值
[
{
"id": "master",
"realm": "master",
"displayName": "Keycloak"
},
{
"id": "test-realm",
"realm": "test-realm"
}
]
获取 realm 下所有 user
GET /admin/realms/{realm}/users
/admin/realms/test-realm/users
返回值
[
{
"id": "041c8601-f5ce-4a9d-93b5-d2d9d150bada",
"createdTimestamp": 1557701098320,
"username": "test-username",
"enabled": true,
"email": "test@test.com"
}
]
获取 realm 下所有 client
GET /admin/realms/{realm}/clients
/admin/realms/test-realm/clients
返回值
[
{
"id": "d6bedbb3-78cf-41b1-9013-4ab060f16fe2",
"clientId": "test-client",
"enabled": true,
"clientAuthenticatorType": "client-secret",
"bearerOnly": false,
"serviceAccountsEnabled": true,
"publicClient": false,
"protocol": "openid-connect",
}
]
获取 client 密码
有密码的情况
{
"type": "secret",
"value": "qI0hdHLhVpMYiXZJ2XBgk0etbXCJPVuX"
}
没有密码的情况
{
"type": "secret"
}
创建 client
POST /admin/realms/{realm}/clients
状态码:409
{
"errorMessage": "Client test3 already exists"
}
官方文档
https://www.keycloak.org/docs-api/21.1.1/rest-api/index.html
Views: 739 · Posted: 2023-08-30
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...