1. Go to this page and download the library: Download taufik-t/uauth-rest-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array<int, string>|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
// add this line
public function __construct()
{
$this->proxies = config('uauth.proxies');
}
}
Route::group(['middleware' => ['sso.api']], function () {
// tempatkan route resource yang ingin di proteksi disini
});
public function boot(): void
{
$this->routes(function () {
Route::middleware('api') // hapus default middleware
->prefix('api')
->group(base_path('routes/api.php'));
// menjadi
Route::prefix('api')
->group(base_path('routes/api.php'));
})
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.