mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 17:44:44 +08:00
Hash existing API keys, and do checks against the hash
This commit is contained in:
@@ -44,8 +44,7 @@ class ApiKey extends AbstractEntity
|
||||
*/
|
||||
public static function fromMeta(ApiKeyMeta $meta): self
|
||||
{
|
||||
// $apiKey = new self(self::hashKey($meta->key), $meta->name, $meta->expirationDate);
|
||||
$apiKey = new self($meta->key, $meta->name, $meta->expirationDate);
|
||||
$apiKey = new self(self::hashKey($meta->key), $meta->name, $meta->expirationDate);
|
||||
foreach ($meta->roleDefinitions as $roleDefinition) {
|
||||
$apiKey->registerRole($roleDefinition);
|
||||
}
|
||||
|
||||
@@ -67,8 +67,7 @@ readonly class ApiKeyService implements ApiKeyServiceInterface
|
||||
private function getByKey(string $key): ApiKey|null
|
||||
{
|
||||
return $this->em->getRepository(ApiKey::class)->findOneBy([
|
||||
// 'key' => ApiKey::hashKey($key),
|
||||
'key' => $key,
|
||||
'key' => ApiKey::hashKey($key),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user