Skip to content

Commit 9f4e780

Browse files
authored
Merge pull request #32 from bwaidelich/patch-1
BUGFIX: Prevent state cache from flooding the filesystem
2 parents e6372e1 + 56d9733 commit 9f4e780

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Classes/OAuthClient.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ public function finishAuthorization(string $stateIdentifier, string $code, strin
359359
if (empty($stateFromCache)) {
360360
throw new OAuthClientException(sprintf('OAuth: Finishing authorization failed because oAuth state %s could not be retrieved from the state cache.', $stateIdentifier), 1558956494);
361361
}
362+
$this->stateCache->remove($stateIdentifier);
362363

363364
$authorizationId = $stateFromCache['authorizationId'];
364365
$clientId = $stateFromCache['clientId'];
@@ -619,6 +620,7 @@ public function shutdownObject(): void
619620
try {
620621
if (random_int(1, 100 * $factor) <= ($this->garbageCollectionProbability * $factor)) {
621622
$this->removeExpiredAuthorizations();
623+
$this->stateCache->collectGarbage();
622624
}
623625
} catch (\Exception $e) {
624626
}

0 commit comments

Comments
 (0)