pickmap/keycloak-middleware 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

pickmap/keycloak-middleware

最新稳定版本:0.5.0

Composer 安装命令:

composer require pickmap/keycloak-middleware

包简介

keycloak

README 文档

README

step #1

install package with below code

composer require pickmap/keycloak-middleware

step #2

‍‍ Go to ‍‍‍‍‍‍‍/config/app.php and put KeycloakMiddlewareServiceProvider::class code

    'providers' => ServiceProvider::defaultProviders()->merge([
        /*
         * Package Service Providers...
         */
        KeycloakMiddlewareServiceProvider::class,

step #3

add this command in terminal in your root of project

php artisan vendor:publish --tag=keycloak-middleware

than add your keycloak public key in /config/keycloak-middleware.php

return [
    'public_key' => null,
];

step #4

Now you can check keycloak tokens by installing middleware ‍‍‍keycloak-middleware for your route

Route::get('/', function () {
    dd(request()->all());
})->middleware('keycloak-middleware');

Scope And Role

Also, you can limit the access of users by sending the required scopes or roles

" * " means all (role or scope)

Route::group(['prefix' => 'v1','middleware' => 'keycloak-middleware:*,*'],function(){
    #  routes
});

Route::group(['prefix' => 'v1','middleware' => 'keycloak-middleware:admin,*'],function(){
    #  routes
});

Route::group(['prefix' => 'v1','middleware' => 'keycloak-middleware:admin|user,view.profile|send.email'],function(){
    #  routes
});

统计信息

  • 总下载量: 537
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-20