定制 marionassef/laravel-keycloak-admin-rest-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

marionassef/laravel-keycloak-admin-rest-api

最新稳定版本:v2.0.2

Composer 安装命令:

composer require marionassef/laravel-keycloak-admin-rest-api

包简介

laravel keycloak admin rest api

README 文档

README

This is a forked repository from https://github.com/Mnikoei/laravel-keycloak-admin

Original work credited to Mnikoei.

Installtion

composer require marionassef/laravel-keycloak-admin-rest-api

Copy the package config to your local config with the publish command:

php artisan vendor:publish --provider="laravelKeycloakAdminRestApi\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_ADMIN_CLIENT_ID=  
          
KEYCLOAK_ADMIN_CLIENT_UUID=            

KEYCLOAK_ADMIN_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

统计信息

  • 总下载量: 7.74k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-16