PHPackages                             adamus/laravel-iam-client - 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. adamus/laravel-iam-client

ActiveLibrary

adamus/laravel-iam-client
=========================

Laravel package for integrating with Adamus IAM service for centralized authentication

0121PHP

Since Mar 9Pushed 2mo agoCompare

[ Source](https://github.com/KwaminaWhyte/laravel-iam-client)[ Packagist](https://packagist.org/packages/adamus/laravel-iam-client)[ RSS](/packages/adamus-laravel-iam-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Adamus Laravel IAM
==================

[](#adamus-laravel-iam)

A complete Laravel package for Identity and Access Management (IAM) that can be installed as either a **Client** or **Server**.

Dual-Mode Package
-----------------

[](#dual-mode-package)

This package can be installed in two modes:

### Client Mode

[](#client-mode)

Use your application to authenticate against a central IAM server. Perfect for microservices and distributed applications.

### Server Mode

[](#server-mode)

Run the complete IAM authentication service. Manage users, roles, permissions, departments, and positions centrally.

Features
--------

[](#features)

### Client Features

[](#client-features)

- 🔐 **Centralized Authentication** - Authenticate users against a central IAM service
- 🎫 **JWT Token Management** - Secure token-based authentication with session storage
- 🔑 **Permission &amp; Role Management** - Check user permissions and roles via IAM API
- 👥 **User/Department/Position Management** - Fetch and manage organizational data from IAM
- 🎨 **Inertia.js Support** - Pre-built React login component
- 🛡️ **Middleware Protection** - Protect routes with IAM authentication
- 💾 **Stateless User Management** - Virtual user instances with no local database storage required
- ⚡ **Request Caching** - Minimize API calls with intelligent caching

### Server Features

[](#server-features)

- 👤 **Complete User Management** - Full CRUD operations for users
- 🎭 **Roles &amp; Permissions** - Powered by Spatie Laravel Permission
- 🏢 **Department Management** - Organizational structure support
- 💼 **Position Management** - Job positions and hierarchies
- 🔐 **JWT Authentication** - Secure token-based auth
- 📝 **Audit Logging** - Track all authentication and authorization events
- 🚫 **Login Attempt Tracking** - Security monitoring and rate limiting
- 📨 **User Invitations** - Invite system for new users
- 🔒 **Two-Factor Authentication** - Enhanced security support

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 11.0 or higher
- Inertia.js (for the login component)
- React (for the login component)

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

Install the package using Composer:

```
composer require adamus/laravel-iam-client
```

### 2. Choose Installation Mode

[](#2-choose-installation-mode)

Run the installation command and select your preferred mode:

```
php artisan iam:install
```

This will prompt you to choose between:

- **Client** - For applications that authenticate against an IAM server
- **Server** - For running the IAM authentication service

Alternatively, you can specify the mode directly:

```
# Install as client
php artisan iam:install-client

# Install as server
php artisan iam:install-server
```

Client Installation
-------------------

[](#client-installation)

When installing as a client, the command will:

- Publish the configuration file to `config/iam.php`
- Publish the login page component to `resources/js/pages/auth/login.tsx`
- Update your `config/auth.php` with IAM guard configuration
- Guide you through environment variable setup

Server Installation
-------------------

[](#server-installation)

When installing as a server, the command will:

- Publish all migrations (users, roles, permissions, departments, positions, audit logs, etc.)
- Publish all models (User, Role, Permission, Department, Position, etc.)
- Publish API controllers for authentication and management
- Publish API routes
- Publish server configuration to `config/iam-server.php`
- Guide you through dependency installation

### 3. Configure Environment Variables

[](#3-configure-environment-variables)

Add the following to your `.env` file:

```
# Required
IAM_BASE_URL=http://your-iam-service.com/api/v1
AUTH_GUARD=iam

# Optional (with defaults)
IAM_TIMEOUT=10
IAM_VERIFY_SSL=true
IAM_USER_MODEL=App\Models\IAMUser
```

### 4. Create IAMUser Model

[](#4-create-iamuser-model)

Create a virtual user model at `app/Models/IAMUser.php` that implements `Authenticatable`:

```
