You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to customize the generation of the unique identifier?
In my case, I'd like to use the UUID, for example, to make sure that the identifier is unique.
In someone else's case, he'd like to use the auto-incremented ID.
What do you think of this improvement to make unique ID generation more easily modifiable?
An idea could be :
publicfunctionenableGrantType(GrantTypeInterface$grantType, DateInterval$accessTokenTTL = null, UniqueIdGeneratorInterface$uniqueIdGenerator = null)
{
if ($accessTokenTTL === null) {
$accessTokenTTL = newDateInterval('PT1H');
}
--> if ($uniqueIdGenerator === null) {
--> $uniqueIdGenerator = /*a class which represents the current unique id generator behavior */;
--> }
$grantType->setAccessTokenRepository($this->accessTokenRepository);
$grantType->setClientRepository($this->clientRepository);
$grantType->setScopeRepository($this->scopeRepository);
$grantType->setDefaultScope($this->defaultScope);
$grantType->setPrivateKey($this->privateKey);
$grantType->setEmitter($this->getEmitter());
$grantType->setEncryptionKey($this->encryptionKey);
$grantType->revokeRefreshTokens($this->revokeRefreshTokens);
--> $grantType->setUniqueIdGenerator($uniqueIdGenerator);
$this->enabledGrantTypes[$grantType->getIdentifier()] = $grantType;
$this->grantTypeAccessTokenTTL[$grantType->getIdentifier()] = $accessTokenTTL;
}
I suggest that the creation of unique identifiers should be handled within the repositories.
For example: The new getNewToken() function should be responsible for setting the identifier.
Additionally, it might be beneficial to check for an existing identifier to prevent overwriting in case the repository has already generated a unique identifier.
Currently, the unique identifier generator is a function available here that cannot be easily modified:
oauth2-server/src/Grant/AbstractGrant.php
Line 569 in eb91b41
Would it be possible to customize the generation of the unique identifier?
In my case, I'd like to use the UUID, for example, to make sure that the identifier is unique.
In someone else's case, he'd like to use the auto-incremented ID.
What do you think of this improvement to make unique ID generation more easily modifiable?
An idea could be :
Or another idea :
The text was updated successfully, but these errors were encountered: