Download the PHP package tuahweb/php-sso-client-connect without Composer
On this page you can find all versions of the php package tuahweb/php-sso-client-connect. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-sso-client-connect
tuahweb/php-sso-client-connect — SSO Client Connect for Laravel
A reusable Laravel package that connects client applications to a Laravel Passport-based SSO Identity Provider (like sso-server). Handles OAuth2 authentication, webhook-driven user sync, role/permission middleware, and automatic user provisioning.
Features
- 🔐 Custom Socialite Provider — OAuth2 Authorization Code + PKCE with
SsoServerProvider - 🔄 Webhook Receiver — HMAC-signed webhook handler for user sync from SSO server
- 🛡️ Middleware —
CheckSsoActive(role access enforcement),VerifySsoSignature(webhook HMAC) - 👤 User Provisioning — Automatic user create/update from SSO data
- 🧩 Fully Configurable — Override User model, jobs, controllers, middleware, and commands via config
Requirements
- PHP 8.3+
- Laravel 11.x, 12.x, or 13.x
laravel/socialite^5.28- MySQL (or any database supported by Laravel)
Installation
Publish Configuration
Configuration
1. Environment Variables (.env)
Setel SSO_PROVIDER sebagai base URL SSO server. Semua endpoint OAuth2 akan diturunkan secara otomatis.
Gunakan variabel berikut jika ingin override endpoint individual (opsional):
2. Service Configuration (config/services.php)
redirect, authorize_url, token_url, user_info_url, dan server_url diturunkan dari SSO_PROVIDER secara otomatis — cukup setel di .env.
Contoh minimal:
3. User Model
Your User model (or any class specified in config('sso.user_model')) should have these columns/methods:
Migration columns:
uuid('id')->primary()— UUID from SSO server as primary keystring('name')string('email')->unique()boolean('is_active')->default(true)json('roles')->nullable()json('permissions')->nullable()timestamp('sso_synced_at')->nullable()
Methods expected by the package (optional, for Gate-based auth):
hasRole(string $role): boolhasPermission(string $permission): bool
4. Middleware Registration (bootstrap/app.php for Laravel 11+)
5. Optional: Gate Registration
In App\Providers\AuthServiceProvider:
Usage
Routes (Auto-Registered)
The package automatically registers these routes:
| Method | URI | Name | Description |
|---|---|---|---|
| GET | /auth/sso/redirect |
auth.sso.redirect |
Redirect to SSO login |
| GET | /auth/sso/callback |
auth.sso.callback |
Handle SSO callback |
| POST | /webhook/sso-sync |
webhook.sso-sync |
Webhook receiver |
You can disable auto-routing in config/sso.php:
Console Commands
Logout Behavior
When a user logs out from a client application:
- Local session only — The client app clears its local session (Auth::logout())
- SSO session preserved — The user remains authenticated on the SSO server
- Redirect to SSO dashboard — User is redirected to the SSO server dashboard after logout
- Access other apps — User can immediately access other client apps without re-authenticating
Example flow:
- User is logged into Client A and Client B
- User clicks logout in Client A
- Client A session is destroyed
- User is redirected to SSO server dashboard
- User can still access Client B without logging in again
Configuration:
To implement full SSO logout (log out from SSO server and all clients), you would need to implement a separate logout endpoint on the SSO server that revokes tokens and triggers logout webhooks to all clients.
Customization
Override the User Model
Override the Webhook Job
Create your own job class that extends the default:
Then update config:
Override Controllers
Extend any package controller and override methods:
Then update config:
Development
For local development, add a path repository in your consuming project's composer.json:
All versions of php-sso-client-connect with dependencies
laravel/socialite Version ^5.28
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/contracts Version ^11.0|^12.0|^13.0