mnikoei/laravel-keycloak-admin
Composer 安装命令:
composer require mnikoei/laravel-keycloak-admin
包简介
This package supports Keycloak admin client api`s
README 文档
README
Installtion
composer require mnikoei/laravel-keycloak-admin
Copy the package config to your local config with the publish command:
php artisan vendor:publish --provider="Mnikoei\KeycloakAdminServiceProvider"
laravel-keycloak-admin
Add these environment variables to your .env :
KEYCLOAK_BASE_URL=http://keycloak-domain.example/auth
KEYCLOAK_REALM=
KEYCLOAK_REALM_PUBLIC_KEY= # realm settings -> keys
KEYCLOAK_CLIENT_ID=
KEYCLOAK_CLIENT_SECRET= # clients -> your_client -> credentials
KEYCLOAK_ADMIN_BASE_URL=${KEYCLOAK_BASE_URL}/admin/realms/${KEYCLOAK_REALM}
Enable realm managment
Go to clients -> your_client -> Service Account then select realm-managment
from Client Roles list and assign realm-admin to client.
Available methods :
Package has provided services as below:
- user
- role
- client
- clientRole
All api's are decleared in config\keycloakAdmin.php
For every api just needs call api name as method on related service .
Example:
KeycloakAdmin::serviceName()->apiName($parameters) keycloakAdmin::user()->create([ 'body' => [ // https://www.keycloak.org/docs-api/7.0/rest-api/index.html#_userrepresentation 'username' => 'foo' ] ]); keycloakAdmin::user()->update([ 'id' => 'user_id', 'body' => [ // https://www.keycloak.org/docs-api/7.0/rest-api/index.html#_userrepresentation 'username' => 'foo' ] ]); keycloakAdmin::role()->get([ 'id' => 'role_id' ]);
All other api calls are same as examples just needs to provide required parameters as described in https://www.keycloak.org/docs-api/7.0/rest-api/index.html
统计信息
- 总下载量: 853
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-09-02