Skip to content

Outsource AbstractGrant::generateUniqueIdentifier #991

Open
@crtl

Description

@crtl

In League\OAuth2\Server\Grant\AbstractGrant I could not understand why generateUniqueIdentifier is implemented as it is.
There is no way to configure the length other than by extending AbstractGrant and override it, but then you have to reimplement all grants again.

I would suggest to define an interface and provide an default implementation with the current length of 40, which is then passed to the grant.

Example:

<?php
//src/Factory/IdentifierFactoryInterface.php
namespace League\OAuth2\Server\Factory;

interface IdentifierFactoryInterface {
  public function generateUniqueIdentifier(): string;
}

OR

Extending the repository interfaces to implement a generateUniqueIdentifier method but this would mix up concerns.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions