diff --git a/solid/lib/JtiReplayDetector.php b/solid/lib/JtiReplayDetector.php index ce5c614d..bb449f52 100644 --- a/solid/lib/JtiReplayDetector.php +++ b/solid/lib/JtiReplayDetector.php @@ -22,11 +22,13 @@ public function __construct(private DateInterval $interval, private IDBConnectio public function detect(string $jti, string $targetUri): bool { + $hash = sha1($targetUri); + // @TODO: $this->rotateBuckets(); - $has = $this->has($jti, $targetUri); + $has = $this->has($jti, $hash); if ($has === false) { - $this->store($jti, $targetUri); + $this->store($jti, $hash); } return $has; diff --git a/solid/lib/Migration/Version000000Date20220923134100.php b/solid/lib/Migration/Version000000Date20220923134100.php deleted file mode 100644 index 4aab8e6d..00000000 --- a/solid/lib/Migration/Version000000Date20220923134100.php +++ /dev/null @@ -1,55 +0,0 @@ -hasTable('solid_jti') === false) { - $table = $schema->createTable('solid_jti'); - - $table->addColumn('id', Types::INTEGER, [ - 'autoincrement' => true, - 'notnull' => true, - ]); - - $table->addColumn('jti', Types::STRING, [ - 'length' => 255, - 'notnull' => true, - ]); - - $table->addColumn('uri', Types::STRING, [ - 'length' => 2048, - 'notnull' => true, - ]); - - $table->addColumn('request_time', Types::DATETIME, [ - 'default' => 'CURRENT_TIMESTAMP', - 'notnull' => true, - ]); - - $table->setPrimaryKey(['id']); - $table->addIndex(['jti', 'uri']); - } - - return $schema; - } -} diff --git a/solid/lib/Migration/Version000000Date20221020145600.php b/solid/lib/Migration/Version000000Date20221020145600.php new file mode 100644 index 00000000..90b3eb1d --- /dev/null +++ b/solid/lib/Migration/Version000000Date20221020145600.php @@ -0,0 +1,58 @@ +hasTable('solid_jti') === true) { + $schema->dropTable('solid_jti'); + } + + $table = $schema->createTable('solid_jti'); + + $table->addColumn('id', Types::INTEGER, [ + 'autoincrement' => true, + 'notnull' => true, + ]); + + $table->addColumn('jti', Types::STRING, [ + 'length' => 255, + 'notnull' => true, + ]); + + $table->addColumn('uri', Types::STRING, [ + 'length' => 40, + 'notnull' => true, + ]); + + $table->addColumn('request_time', Types::DATETIME, [ + 'default' => 'CURRENT_TIMESTAMP', + 'notnull' => true, + ]); + + $table->setPrimaryKey(['id']); + $table->addIndex(['jti', 'uri']); + + return $schema; + } +}