mostafafathi/user-auth

Laravel package for user type management with SSO and OTP authentication

Installs: 23

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/mostafafathi/user-auth

v1.1.13 2025-10-16 10:20 UTC

This package is auto-updated.

Last update: 2026-01-13 09:03:56 UTC


README

A comprehensive Laravel package for user type management with SSO and OTP authentication support.

Features

  • Multiple user types with permissions
  • SSO authentication (SAML, OpenID Connect)
  • OTP-based authentication as fallback
  • Development-friendly with test email support
  • Flexible configuration

Requirements

  • PHP 8.2 or higher
  • Laravel 11.x or 12.x

Installation

You can install the package via Composer:

composer require mostafafathi/user-auth

Configuration

Publish the configuration file:

php artisan vendor:publish --provider="MostafaFathi\\UserAuth\\UserAuthServiceProvider" --tag=user-auth-config

Publish and run migrations:

php artisan vendor:publish --provider="MostafaFathi\\UserAuth\\UserAuthServiceProvider" --tag=user-auth-migrations
php artisan migrate

Seed user types:

php artisan db:seed --class=UserTypeSeeder

Usage

Environment Variables

Add these to your .env file:

USER_AUTH_METHOD=sso
SSO_ENABLED=true
OTP_ENABLED=true
TEST_EMAIL=test@example.com

To Overwrite Routes

// SSO Routes
Route::get('/auth/sso/redirect', [SsoAuthController::class, 'redirectToSso'])->name('sso.redirect');
Route::get('/auth/sso/callback', [SsoAuthController::class, 'ssoCallback'])->name('sso.callback');

// OTP Routes
Route::get('/auth/verify', [SsoAuthController::class, 'otpVerifyPage'])->name('otpVerifyPage');
Route::post('/auth/otp/request', [SsoAuthController::class, 'requestOtp'])->name('otp.request');
Route::post('/auth/otp/verify', [SsoAuthController::class, 'verifyOtp'])->name('otp.verify');

SSO Configuration

Configure your SSO providers in the "config/user-auth.php" file.

License

The MIT License (MIT). Please see License File for more information.