定制 arietimmerman/laravel-scim-server 二次开发

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

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

arietimmerman/laravel-scim-server

Composer 安装命令:

composer require arietimmerman/laravel-scim-server

包简介

Laravel Package for creating a SCIM server

README 文档

README

Latest Stable Version Total Downloads

Logo of Laravel SCIM Server, the SCIM server implementation from scim.dev, SCIM Playground

SCIM 2.0 Server implementation for Laravel

Add SCIM 2.0 Server capabilities to your Laravel application with ease. This package requires minimal configuration to get started with the core SCIM flows and is powering The SCIM Playground, one of the most widely tested SCIM servers available.

Why Laravel SCIM Server?

  • Battle-tested with real-world providers through the SCIM Playground
  • Familiar Laravel tooling and middleware integration
  • Fully extensible configuration for resources, attributes, and filtering
  • Ships with dockerized demo and an expressive test suite

Table of contents

Quick start

Spin up a SCIM test server in seconds:

docker run -d -p 8000:8000 --name laravel-scim-server ghcr.io/limosa-io/laravel-scim-server:latest

Visit http://localhost:8000/scim/v2/Users (or /Groups, /Schemas, /ResourceTypes, etc.) to exercise the API.

Installation

Add the package to your Laravel app:

composer require arietimmerman/laravel-scim-server

Optionally publish the config for fine-grained control:

php artisan vendor:publish --tag=laravel-scim

If you need to add SCIM-specific columns (formatted, active, roles) to your users table, publish the migrations:

php artisan vendor:publish --tag=laravel-scim-migrations
php artisan migrate

Note: These migrations are optional. Only publish them if your SCIM implementation requires these specific fields in your users table.

SCIM routes

Method Path Description
GET /scim/v1 SCIM 1.x compatibility message (returns error with upgrade guidance)
GET /scim/v2 Cross-resource index (alias of /scim/v2/)
GET /scim/v2/ Cross-resource index
POST /scim/v2/.search Cross-resource search across all types
POST /scim/v2/Bulk SCIM bulk operations
GET /scim/v2/ResourceTypes List available resource types
GET /scim/v2/ResourceTypes/{id} Retrieve a specific resource type
GET /scim/v2/Schemas List SCIM schemas
GET /scim/v2/Schemas/{id} Retrieve a specific schema
GET /scim/v2/ServiceProviderConfig Discover server capabilities
GET /scim/v2/{resourceType} List resources of a given type
POST /scim/v2/{resourceType} Create a new resource
POST /scim/v2/{resourceType}/.search Filter resources of a given type
GET /scim/v2/{resourceType}/{resourceObject} Retrieve a single resource
PUT /scim/v2/{resourceType}/{resourceObject} Replace a resource
PATCH /scim/v2/{resourceType}/{resourceObject} Update a resource
DELETE /scim/v2/{resourceType}/{resourceObject} Delete a resource

Optional "Me" routes can be enabled separately:

Method Path Description
GET /scim/v2/Me Retrieve the SCIM resource for the authenticated subject
PUT /scim/v2/Me Replace the SCIM resource for the authenticated subject
POST /scim/v2/Me Create the authenticated subject (requires RouteProvider::meRoutePost())

Configuration

The SCIM server can be customized using configuration options in config/scim.php:

return [
    // Base path for all SCIM routes
    'path' => env('SCIM_BASE_PATH', '/scim'),

    // Optional domain to restrict SCIM endpoints to
    'domain' => env('SCIM_DOMAIN', null),

    // Middleware for protected routes (resource operations)
    'middleware' => env('SCIM_MIDDLEWARE', []),

    // Middleware for public routes (ServiceProviderConfig, Schemas, ResourceTypes)
    'public_middleware' => env('SCIM_PUBLIC_MIDDLEWARE', []),

    // Omit the main schema namespace from resource responses
    'omit_main_schema_in_return' => env('SCIM_OMIT_MAIN_SCHEMA_IN_RETURN', false),
    
    // Omit attributes with null values from responses
    'omit_null_values' => env('SCIM_OMIT_NULL_VALUES', true),
];

You can override these in your .env file:

SCIM_BASE_PATH=/scim/api
SCIM_MIDDLEWARE=api,auth:sanctum
SCIM_PUBLIC_MIDDLEWARE=api
SCIM_OMIT_MAIN_SCHEMA_IN_RETURN=true
SCIM_OMIT_NULL_VALUES=false

Or pass as Docker environment variables:

docker run -e SCIM_BASE_PATH=/scim/api \
           -e SCIM_OMIT_MAIN_SCHEMA_IN_RETURN=true \
           -e SCIM_OMIT_NULL_VALUES=false \
           -p 8000:8000 \
           ghcr.io/limosa-io/laravel-scim-server:latest

If you need more control, you can disable route auto-publishing and register the routes manually:

// config/scim.php
return [
    'publish_routes' => false,
    // other config...
];

// In your RouteServiceProvider or a custom service provider:
ArieTimmerman\Laravel\SCIMServer\RouteProvider::routes([
    'path' => '/custom-scim',
    'domain' => 'api.example.com',
    'middleware' => ['api', 'auth:api', 'scoped-tokens'],
    'public_middleware' => ['api', 'rate-limit'],
]);

Resource Configuration

The package resolves configuration via SCIMConfig::class. Extend it to tweak resource definitions, attribute mappings, filters, or pagination defaults.

Register your custom config in app/Providers/AppServiceProvider.php:

$this->app->singleton(
    \ArieTimmerman\Laravel\SCIMServer\SCIMConfig::class,
    YourCustomSCIMConfig::class
);

Minimal override example:

<?php

class YourCustomSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
{
    public function getUserConfig()
    {
        $config = parent::getUserConfig();

        // Customize $config as needed.

        return $config;
    }
}

Pagination settings

Cursor-based pagination is enabled by default via the SCIM cursor pagination draft. Publish the config file and update config/scim.php to adjust defaults:

'pagination' => [
    'defaultPageSize' => 10,
    'maxPageSize' => 100,
    'cursorPaginationEnabled' => false,
]

Security & app integration

SCIM grants the ability to view, add, update, and delete users or groups. Make sure you secure the routes before shipping to production.

You have two approaches to securing your SCIM endpoints:

Option 1: Configure middleware via config

The simplest approach is to set middleware in your config:

// config/scim.php
return [
    'middleware' => ['api', 'auth:sanctum'], // For protected resource routes
    'public_middleware' => ['api'],          // For schema/discovery endpoints
];

Or via environment variables:

SCIM_MIDDLEWARE=api,auth:sanctum
SCIM_PUBLIC_MIDDLEWARE=api

Option 2: Manual route registration

For more control, disable automatic route publishing:

// config/scim.php
return [
    'publish_routes' => false,
];

Then re-register the routes with your preferred middleware and configuration:

use ArieTimmerman\Laravel\SCIMServer\RouteProvider as SCIMServerRouteProvider;

SCIMServerRouteProvider::publicRoutes([
    'path' => '/scim',
    'middleware' => ['api'],
]);

Route::middleware('auth:api')->group(function () {
    SCIMServerRouteProvider::routes([
        'path' => '/scim',
        'middleware' => ['custom-scim-check'],
        'public_routes' => false,
    ]);

    SCIMServerRouteProvider::meRoutes();
});

Test server

Bring up the full demo stack with Docker Compose:

docker-compose up

Browse to http://localhost:18123/scim/v2/Users to explore the API and run the test suite.

Contributing & support

  • Issues and pull requests are welcome on GitHub
  • Found this package helpful? Give it a star on GitHub so others can discover it faster
  • If you would like to support this module, please buy a Pro subscription on SCIM Playground

arietimmerman/laravel-scim-server 适用场景与选型建议

arietimmerman/laravel-scim-server 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 423.4k 次下载、GitHub Stars 达 95, 最近一次更新时间为 2018 年 01 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 arietimmerman/laravel-scim-server 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 arietimmerman/laravel-scim-server 我们能提供哪些服务?
定制开发 / 二次开发

基于 arietimmerman/laravel-scim-server 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 95
  • Watchers: 9
  • Forks: 44
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-17