zploited / laravel-identity
Identity client for Laravel, simplifying the authentication flows towards your Identity tenant.
Requires
- php: ^8.0
- laravel/framework: ^9.29|^10.0
- zploited/php-identity: dev-main
Requires (Dev)
- orchestra/testbench: ^7.7
This package is auto-updated.
Last update: 2025-03-24 16:20:29 UTC
README
Installation
Package installation
The Laravel package can be installed using composer
composer require zploited/laravel-identity
After that you will need to configure your client information in your .env file, with these settings:
IDENTITY_IDENTIFIER=<tenant identifying domain name> IDENTITY_CLIENT_ID=<identifier of the app> IDENTITY_CLIENT_SECRET=<secret of the app> IDENTITY_REDIRECT_URI=<redirect url, that will handle incoming token> IDENTITY_SCOPE=<scopes to use> IDENTITY_PROTOCOL=<http or https - default is https>
Guards
The package comes with two different guards, that served each of their own purposes.
- identity:session
- identity:bearer
You will need to add the guard you want to use in your config/auth.php file. This is done by adding the driver you want to use to the 'guards' section of the file, f.ex.
'guards' => [ 'web' => [ 'driver' => 'identity:session' ], ],
Noticed that the provider has been removed since the guard doesn't use a provider.
Usage
Identity class
From now on, everything is handled through the Zploited\Identity\Client\Identity class. It can be either be instanced through dependency injection, or through:
$identity = app()->make(Zploited\Identity\Client\Identity::class);
This will get an instance with the configurations from config/identity-client.php.