geodeticca / laravel-iam
Simple package to provide support to geodeticca IAM.
dev-master
2023-08-21 07:30 UTC
Requires
- php: >=7.4.0
- dense/delivery: dev-master
- dense/enum: dev-master
- dense/jwt-auth: v2.x-dev
- dense/laravel-assistant: dev-master
- dense/laravel-informer: dev-master
- guzzlehttp/guzzle: ^7.7
- illuminate/auth: >=5.8
- illuminate/support: >=5.8
- laravel/ui: >=1.3
This package is auto-updated.
Last update: 2024-12-03 17:28:58 UTC
README
Simple package extending laravel auth via JWT.
About
Package that it is required is dense\enum package which is just few simple classes for easier enumerations handling.
Instalation
Run following composer command.
composer require geodeticca/iam
composer require laravel/ui
Run artisan command
php artisan iam:generate
This command will generate controllers in App\Http\Conrollers\Iam directory.
Configuration
Add these lines on top of the web routes configration file in routes/web.php.
Auth::routes([
'register' => false,
'verify' => false,
'reset' => false,
]);
Add these settings to config/auth.php file.
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'geodeticca-web',
],
'api' => [
'driver' => 'geodeticca-api',
],
'autologin' => [
'driver' => 'geodeticca-autologin',
],
],
If you need only token for javascript application or testing purposes. Login process requires system user account details.
$guard = Auth::guard('autologin');
$attempt = $guard->attempt([
'app' => config('iam.app'),
'login' => config('iam.service.login'),
'password' => config('iam.service.password'),
]);
if (!$attempt) {
throw new \Exception('Invalid login.');
}
$tokem = $guard->getProvider()->getJwtToken();
If you are running lumen you need to add following lines to bootstrap/app.php file.
$app->register(\Geodeticca\Iam\IamServiceProvider::class);