Skip to content

Commit

Permalink
Revert "[10.x] Add purging of invalid refresh tokens to command (#1396)…
Browse files Browse the repository at this point in the history
…" (#1397)

This reverts commit 985577c.
  • Loading branch information
driesvints authored Jan 14, 2021
1 parent 985577c commit 8b792b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 52 deletions.
11 changes: 4 additions & 7 deletions src/Console/PurgeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PurgeCommand extends Command
*
* @var string
*/
protected $description = 'Purge revoked and / or expired tokens, authentication codes, and refresh tokens.';
protected $description = 'Purge revoked and / or expired tokens and authentication codes';

/**
* Execute the console command.
Expand All @@ -36,23 +36,20 @@ public function handle()
Passport::token()->where('revoked', 1)->orWhereDate('expires_at', '<', $expired)->delete();
Passport::authCode()->where('revoked', 1)->orWhereDate('expires_at', '<', $expired)->delete();
Passport::refreshToken()->where('revoked', 1)->orWhereDate('expires_at', '<', $expired)->delete();
Passport::refreshToken()->whereDoesntHave('accessToken')->delete();

$this->info('Purged invalid refresh tokens, revoked tokens, and tokens expired for more than seven days.');
$this->info('Purged revoked items and items expired for more than seven days.');
} elseif ($this->option('revoked')) {
Passport::token()->where('revoked', 1)->delete();
Passport::authCode()->where('revoked', 1)->delete();
Passport::refreshToken()->where('revoked', 1)->delete();
Passport::refreshToken()->whereDoesntHave('accessToken')->delete();

$this->info('Purged invalid refresh tokens and revoked tokens.');
$this->info('Purged revoked items.');
} elseif ($this->option('expired')) {
Passport::token()->whereDate('expires_at', '<', $expired)->delete();
Passport::authCode()->whereDate('expires_at', '<', $expired)->delete();
Passport::refreshToken()->whereDate('expires_at', '<', $expired)->delete();
Passport::refreshToken()->whereDoesntHave('accessToken')->delete();

$this->info('Purged invalid refresh tokens and tokens expired for more than seven days.');
$this->info('Purged items expired for more than seven days.');
}
}
}
45 changes: 0 additions & 45 deletions tests/Feature/Console/PurgeCommand.php

This file was deleted.

0 comments on commit 8b792b4

Please sign in to comment.