Skip to content

Commit

Permalink
fix(120): Credential Revocation - (Pg)SQL error : Datatype mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordy Kiesebrink committed Mar 22, 2023
1 parent ff14fe0 commit b61b984
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Service/CredentialsRevoker/DoctrineCredentialsRevoker.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,17 @@ public function revokeCredentialsForUser(UserInterface $user): void

$this->entityManager->createQueryBuilder()
->update(AccessToken::class, 'at')
->set('at.revoked', true)
->set('at.revoked', ':revoked')
->where('at.userIdentifier = :userIdentifier')
->setParameter('revoked', true)
->setParameter('userIdentifier', $userIdentifier)
->getQuery()
->execute();

$queryBuilder = $this->entityManager->createQueryBuilder();
$queryBuilder
->update(RefreshToken::class, 'rt')
->set('rt.revoked', true)
->set('rt.revoked', ':revoked')
->where($queryBuilder->expr()->in(
'rt.accessToken',
$this->entityManager->createQueryBuilder()
Expand All @@ -58,14 +59,16 @@ public function revokeCredentialsForUser(UserInterface $user): void
->where('at.userIdentifier = :userIdentifier')
->getDQL()
))
->setParameter('revoked', true)
->setParameter('userIdentifier', $userIdentifier)
->getQuery()
->execute();

$this->entityManager->createQueryBuilder()
->update(AuthorizationCode::class, 'ac')
->set('ac.revoked', true)
->set('ac.revoked', ':revoked')
->where('ac.userIdentifier = :userIdentifier')
->setParameter('revoked', true)
->setParameter('userIdentifier', $userIdentifier)
->getQuery()
->execute();
Expand All @@ -78,15 +81,16 @@ public function revokeCredentialsForClient(AbstractClient $client): void

$this->entityManager->createQueryBuilder()
->update(AccessToken::class, 'at')
->set('at.revoked', true)
->set('at.revoked', ':revoked')
->where('at.client = :client')
->setParameter('client', $doctrineClient->getIdentifier(), 'string')
->setParameter('revoked', true)
->getQuery()
->execute();

$queryBuilder = $this->entityManager->createQueryBuilder();
$queryBuilder->update(RefreshToken::class, 'rt')
->set('rt.revoked', true)
->set('rt.revoked', ':revoked')
->where($queryBuilder->expr()->in(
'rt.accessToken',
$this->entityManager->createQueryBuilder()
Expand All @@ -96,14 +100,16 @@ public function revokeCredentialsForClient(AbstractClient $client): void
->getDQL()
))
->setParameter('client', $doctrineClient->getIdentifier(), 'string')
->setParameter('revoked', true)
->getQuery()
->execute();

$this->entityManager->createQueryBuilder()
->update(AuthorizationCode::class, 'ac')
->set('ac.revoked', true)
->set('ac.revoked', ':revoked')
->where('ac.client = :client')
->setParameter('client', $doctrineClient->getIdentifier(), 'string')
->setParameter('revoked', true)
->getQuery()
->execute();
}
Expand Down

0 comments on commit b61b984

Please sign in to comment.