PHPackages                             notrel/laravel-wso2is - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. notrel/laravel-wso2is

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

notrel/laravel-wso2is
=====================

A Laravel package for integrating with WSO2 Identity Server

v1.1.4(10mo ago)08MITPHPPHP ^8.2

Since Sep 1Pushed 10mo agoCompare

[ Source](https://github.com/notrel-net/laravel-wso2is)[ Packagist](https://packagist.org/packages/notrel/laravel-wso2is)[ RSS](/packages/notrel-laravel-wso2is/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (8)Versions (8)Used By (0)

Laravel WSO2 Identity Server
============================

[](#laravel-wso2-identity-server)

A Laravel package for integrating with WSO2 Identity Server, providing OAuth2 authentication, user management, SCIM2 API access, and convenient middleware for session management.

Features
--------

[](#features)

- 🔐 **OAuth2/OIDC Authentication** - Complete OIDC flow with login, callback, and logout
- 👥 **User Management** - SCIM2 API for user CRUD operations
- 👪 **Group Management** - SCIM2 API for group operations
- 🏢 **Application Management** - WSO2IS REST API for application configuration
- 🛡️ **Session Middleware** - Automatic token validation and refresh
- 📝 **Request Classes** - Laravel-style request classes for clean authentication flows
- ✅ **Pest Testing** - Comprehensive test suite with Pest framework

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require notrel/laravel-wso2is
```

The package will automatically register its service provider.

### Configuration

[](#configuration)

Add your WSO2IS configuration to your `config/services.php` file:

```
'wso2is' => [
    'base_url' => env('WSO2IS_BASE_URL', 'https://localhost:9443'),
    'client_id' => env('WSO2IS_CLIENT_ID'),
    'client_secret' => env('WSO2IS_CLIENT_SECRET'),
    'redirect_uri' => env('WSO2IS_REDIRECT_URI'),
    'scopes' => env('WSO2IS_SCOPES', 'openid,profile,email'),
    'scim_username' => env('WSO2IS_SCIM_USERNAME'),
    'scim_password' => env('WSO2IS_SCIM_PASSWORD'),
],
```

Then update your `.env` file:

```
WSO2IS_BASE_URL=https://your-wso2is-instance.com
WSO2IS_CLIENT_ID=your-client-id
WSO2IS_CLIENT_SECRET=your-client-secret
WSO2IS_REDIRECT_URI=https://your-app.com/auth/callback
WSO2IS_SCOPES="openid,profile,email"
WSO2IS_SCIM_USERNAME=your-scim-username
WSO2IS_SCIM_PASSWORD=your-scim-password
```

Usage
-----

[](#usage)

### Authentication with Request Classes (Recommended)

[](#authentication-with-request-classes-recommended)

The package provides convenient request classes similar to Laravel WorkOS. You create the routes and controllers in your application:

#### 1. Create Your Authentication Routes

[](#1-create-your-authentication-routes)

```
// routes/web.php
use Notrel\LaravelWso2is\Http\Requests\Wso2isLoginRequest;
use Notrel\LaravelWso2is\Http\Requests\Wso2isAuthenticationRequest;
use Notrel\LaravelWso2is\Http\Requests\Wso2isLogoutRequest;
use Notrel\LaravelWso2is\Http\Requests\Wso2isAccountDeletionRequest;

Route::get('/auth/login', function (Wso2isLoginRequest $request) {
    return $request->redirect([
        'prompt' => 'login', // Optional: force login prompt
        'loginHint' => 'user@example.com', // Optional: pre-fill username
        'domainHint' => 'example.com', // Optional: domain hint
    ]);
})->name('auth.login');

Route::get('/auth/callback', function (Wso2isAuthenticationRequest $request) {
    $user = $request->authenticate();
    return $request->redirect('/dashboard');
})->name('auth.callback');

Route::post('/auth/logout', function (Wso2isLogoutRequest $request) {
    return $request->logout('/'); // Optional: redirect URL after logout
})->name('auth.logout');

Route::delete('/auth/delete-account', function (Wso2isAccountDeletionRequest $request) {
    return $request->deleteAccount(redirectTo: '/'); // Optional: redirect URL after deletion
})->name('auth.delete-account')->middleware('auth');
```

#### 2. Or Create a Controller

[](#2-or-create-a-controller)

```
// app/Http/Controllers/AuthController.php
