Skip to content

Commit

Permalink
Merge pull request #711 from nextcloud/fix/column-length-clientid-and…
Browse files Browse the repository at this point in the history
…-secret

increased column length for id and secret
  • Loading branch information
julien-nc authored Dec 18, 2023
2 parents a477be7 + a7e97ff commit 65b75d8
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions lib/Migration/Version010304Date20231121102449.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

declare(strict_types=1);

namespace OCA\UserOIDC\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
use OCP\Security\ICrypto;

class Version010304Date20231121102449 extends SimpleMigrationStep {

/**
* @var IDBConnection
*/
private $connection;
/**
* @var ICrypto
*/
private $crypto;

public function __construct(
IDBConnection $connection,
ICrypto $crypto
) {
$this->connection = $connection;
$this->crypto = $crypto;
}

public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

$schemaChanged = false;
foreach (['user_oidc_providers', 'user_oidc_id4me'] as $tableName) {
if ($schema->hasTable($tableName)) {
$table = $schema->getTable($tableName);
if ($table->hasColumn('client_secret')) {
$column = $table->getColumn('client_secret');
$column->setLength(2048);
$schemaChanged = true;
}
if ($table->hasColumn('client_id')) {
$column = $table->getColumn('client_id');
$column->setLength(2048);
$schemaChanged = true;
}
}
}
if ($schemaChanged) {
return $schema;
}
return null;
}
}

0 comments on commit 65b75d8

Please sign in to comment.