Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Bridge/AccessTokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use DateTime;
use Illuminate\Contracts\Events\Dispatcher;
use Laravel\Passport\Events\AccessTokenCreated;
use Laravel\Passport\Passport;
use Laravel\Passport\TokenRepository;
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
use League\OAuth2\Server\Entities\ClientEntityInterface;
Expand Down Expand Up @@ -46,7 +47,7 @@ public function __construct(TokenRepository $tokenRepository, Dispatcher $events
*/
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null)
{
return new AccessToken($userIdentifier, $scopes, $clientEntity);
return new Passport::$accessTokenEntity($userIdentifier, $scopes, $clientEntity);
}

/**
Expand Down
18 changes: 18 additions & 0 deletions src/Passport.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ class Passport
*/
public static $keyPath;

/**
* The access token entity class name.
*
* @var string
*/
public static $accessTokenEntity = 'Laravel\Passport\Bridge\AccessToken';

/**
* The auth code model class name.
*
Expand Down Expand Up @@ -432,6 +439,17 @@ public static function keyPath($file)
: storage_path($file);
}

/**
* Set the access token entity class name.
*
* @param string $accessTokenEntity
* @return void
*/
public static function useAccessTokenEntity($accessTokenEntity)
{
static::$accessTokenEntity = $accessTokenEntity;
}

/**
* Set the auth code model class name.
*
Expand Down