Skip to content

Commit

Permalink
bug #131 fix(120): Credential Revocation - (Pg)SQL error : Datatype m…
Browse files Browse the repository at this point in the history
…ismatch (Jordy Kiesebrink)

This PR was merged into the 0.4-dev branch.

Discussion
----------

fix(120): Credential Revocation - (Pg)SQL error : Datatype mismatch

issue #120

Commits
-------

b61b984 fix(120): Credential Revocation - (Pg)SQL error : Datatype mismatch
  • Loading branch information
chalasr committed Apr 23, 2023
2 parents b4a7c22 + b61b984 commit 2ac15ea
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 2ac15ea

Please sign in to comment.