Skip to content

Commit

Permalink
Updating Passport to use a Key object for faster encryption/decryptio…
Browse files Browse the repository at this point in the history
…n, when combined with oauth2-server package patch from thephpleague/oauth2-server#814
  • Loading branch information
EricTendian committed Sep 10, 2018
1 parent 3e2ff83 commit 3c66329
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/PassportServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Laravel\Passport;

use DateInterval;
use Defuse\Crypto\Key;
use Defuse\Crypto\Encoding;
use Illuminate\Auth\RequestGuard;
use Illuminate\Auth\Events\Logout;
use Illuminate\Support\Facades\Auth;
Expand Down Expand Up @@ -199,12 +201,15 @@ protected function makeImplicitGrant()
*/
public function makeAuthorizationServer()
{
// Make a new AsciiSafeString so we can generate a Defuse\Crypto\Key object from that
$encryptionKeyAscii = Encoding::saveBytesToChecksummedAsciiSafeString(Key::KEY_CURRENT_VERSION, app('encrypter')->getKey());
return new AuthorizationServer(
$this->app->make(Bridge\ClientRepository::class),
$this->app->make(Bridge\AccessTokenRepository::class),
$this->app->make(Bridge\ScopeRepository::class),
$this->makeCryptKey('private'),
app('encrypter')->getKey()
// Use a Key object instead of a string so we can take advantage of faster encryption/decryption from https://github.com/thephpleague/oauth2-server/pull/814
Key::loadFromAsciiSafeString($encryptionKeyAscii)
);
}

Expand Down

0 comments on commit 3c66329

Please sign in to comment.