Skip to content

Testing v9-rc1 on Laravel Passport #1398

Closed
@hafezdivandari

Description

@hafezdivandari

Trying to add support and test v9-rc1 before stable release on Laravel Passport, PR laravel/passport#1734, there are 2 issues:

  1. User ID doesn't accept integer
  2. Client ID doesn't accept integer

You may check the failed tests here: https://github.com/laravel/passport/actions/runs/8482967241/job/23243211337?pr=1734

Both User and Client classes of Laravel Passport are using League\OAuth2\Server\Entities\Traits\EntityTrait.

  • This trait accepts mixed id on set but return string on get:

    /**
    * @return non-empty-string
    */
    public function getIdentifier(): string
    {
    return $this->identifier;
    }
    public function setIdentifier(mixed $identifier): void
    {
    $this->identifier = $identifier;
    }

  • Also on the TokenInterface class, $userIdentifier type doesn't match on set / get :

    /**
    * Set the identifier of the user associated with the token.
    *
    * @param non-empty-string $identifier
    */
    public function setUserIdentifier(string $identifier): void;
    /**
    * Get the token user's identifier.
    */
    public function getUserIdentifier(): string|int|null;

  • On AccessTokenRepositoryInterface the $userIdentifier property accepts mixed:

  • On AbstractGrant class, getClientEntityOrFail method accepts only string $clientId and not int:

    protected function getClientEntityOrFail(string $clientId, ServerRequestInterface $request): ClientEntityInterface

  • On ClientRepositoryInterface class, getClientEntity and validateClient methods, $clientIdentifier argument doesn't accept int:

    public function getClientEntity(string $clientIdentifier): ?ClientEntityInterface;
    /**
    * Validate a client's secret.
    */
    public function validateClient(string $clientIdentifier, ?string $clientSecret, ?string $grantType): bool;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions