-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/main setting up signed webkey authentication. removing unused…
… cold.
- Loading branch information
Showing
29 changed files
with
195 additions
and
1,094 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Models\User; | ||
use App\Providers\AuthorizationProvider; | ||
use Carbon\Carbon; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Hash; | ||
|
||
class CreateSignature extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'app:create-signature'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Creates signature for http requests'; | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle() | ||
{ | ||
$this->info('Laravel API Service'); | ||
$this->info('Signed access token generation script.'); | ||
$this->warn('Before moving ahead, define your access key in ./config/laravel-mail-api-token.php'); | ||
$this->info('---------------------------------------'); | ||
|
||
$accessKey = $this->ask('Inform the Token Access Key'); | ||
|
||
$tokenAttributes = AuthorizationProvider::getTokenProperties($accessKey); | ||
$timezone = Carbon::now()->toIso8601String(); | ||
$this->info('tz: ' . $timezone); | ||
$signature = AuthorizationProvider::signToken( | ||
token: $tokenAttributes['appKey'], | ||
timeStamp: $timezone, | ||
secret: $tokenAttributes['appSecret'], | ||
); | ||
|
||
$this->info($signature); | ||
|
||
return 1; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use App\Providers\AuthorizationProvider; | ||
use Closure; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Log; | ||
|
||
class Authorize | ||
{ | ||
/** | ||
* @return mixed | ||
*/ | ||
public function handle(Request $request, Closure $next) | ||
{ | ||
Log::info('Validate token authorization'); | ||
|
||
AuthorizationProvider::authorize($request); | ||
|
||
return $next($request); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.