This package is used to authenticate NON CRITICAL requests between our applications.
| Laravel | Package |
|---|---|
| 8.x / 9.x | 1.x |
| 12.x | 2.x |
composer require deegitalbe/server-authorization
You should define secret key in your .env file :
TRUSTUP_SERVER_AUTHORIZATION=your_secret_key
If you want to have more control about configuration, publish it :
php artisan vendor:publish --provider="Deegitalbe\ServerAuthorization\Providers\ServerAuthorizationServiceProvider" --tag="config"
You can add this middleware to any route that should be protected :
Deegitalbe\ServerAuthorization\Http\Middleware\AuthorizedServer
if you use my client to make requests, you can use this Credential to automatically authenticate your request :
Deegitalbe\ServerAuthorization\Credential\AuthorizedServerCredential
If you need more control, extend credential this way :
use Henrotaym\LaravelApiClient\Contracts\RequestContract;
use Deegitalbe\ServerAuthorization\Credential\AuthorizedServerCredential;
class MyCustomCredential extends AuthorizedServerCredential {
/**
* Preparing request.
*
* @param RequestContract $request
* @return void
*/
public function prepare(RequestContract &$request)
{
parent::prepare($request);
// your custom code here...
}
}