sunxyw / spiral-auth0-bridge
This is my package spiral-auth0-bridge
Fund package maintenance!
roadrunner-server
Requires
- php: ^8.1
- auth0/auth0-php: ^8.7
- spiral/auth: ^3.7
- spiral/auth-http: ^3.7
- spiral/boot: ^3.7
- spiral/console: ^3.7
Requires (Dev)
- mockery/mockery: ^1.5
- phpunit/phpunit: ^10.1
- spiral/testing: ^2.0
- vimeo/psalm: ^5.9
This package is auto-updated.
Last update: 2024-11-05 15:32:21 UTC
README
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
Requirements
Make sure that your server is configured with following PHP version and extensions:
- PHP 8.1+
- Spiral framework 3.0+
Installation
You can install the package via composer:
composer require sunxyw/spiral-auth0-bridge
After package install you need to register bootloader from the package.
protected const LOAD = [ // ... \Sunxyw\SpiralAuth0Bridge\Bootloader\Auth0BridgeBootloader::class, ];
Note: if you are using
spiral-packages/discoverer
, you don't need to register bootloader by yourself.
Usage
Register the \Sunxyw\SpiralAuth0Bridge\Security\Auth0TokenStorage
token storage via config or bootloader, you may find
documentation here.
Then, register the actor provider \Sunxyw\SpiralAuth0Bridge\Security\Auth0ActorProvider
via bootloader too,
documentation may
find here.
You may want to scroll down the documentation page to find the registration steps.
Please remember to configure your AuthTransportMiddleware too, otherwise, Auth0 bridge will not able to retrieve the token. Docs.
After that, you can obtain the actor using AuthContextInterface
.
public function index(\Spiral\Auth\AuthContextInterface $auth) { if ($auth->getActor() === null) { throw new ForbiddenException(); } dump($auth->getActor()); }
The actor will be an instance of \Sunxyw\SpiralAuth0Bridge\Security\Auth0Actor
.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.