Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions solid/lib/JtiReplayDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
55 changes: 0 additions & 55 deletions solid/lib/Migration/Version000000Date20220923134100.php

This file was deleted.

58 changes: 58 additions & 0 deletions solid/lib/Migration/Version000000Date20221020145600.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

declare(strict_types=1);

namespace OCA\Solid\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;

class Version000000Date20221020145600 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper
{
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

// As the JTI table should only contain short-lived data anyway, it can safely be dropped
if ($schema->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;
}
}