mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
Merge pull request #35616 from nextcloud/backport/fix/empty-secret-migration-files-external
[stable25] Fix migration to non-empty secret
This commit is contained in:
commit
5bc2154bf0
2 changed files with 10 additions and 2 deletions
|
|
@ -60,7 +60,11 @@ class RSA extends AuthMechanism {
|
|||
$auth = new RSACrypt();
|
||||
$auth->setPassword($this->config->getSystemValue('secret', ''));
|
||||
if (!$auth->loadKey($storage->getBackendOption('private_key'))) {
|
||||
throw new \RuntimeException('unable to load private key');
|
||||
// Add fallback routine for a time where secret was not enforced to be exists
|
||||
$auth->setPassword('');
|
||||
if (!$auth->loadKey($storage->getBackendOption('private_key'))) {
|
||||
throw new \RuntimeException('unable to load private key');
|
||||
}
|
||||
}
|
||||
$storage->setBackendOption('public_key_auth', $auth);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,11 @@ class RSAPrivateKey extends AuthMechanism {
|
|||
$auth = new RSACrypt();
|
||||
$auth->setPassword($this->config->getSystemValue('secret', ''));
|
||||
if (!$auth->loadKey($storage->getBackendOption('private_key'))) {
|
||||
throw new \RuntimeException('unable to load private key');
|
||||
// Add fallback routine for a time where secret was not enforced to be exists
|
||||
$auth->setPassword('');
|
||||
if (!$auth->loadKey($storage->getBackendOption('private_key'))) {
|
||||
throw new \RuntimeException('unable to load private key');
|
||||
}
|
||||
}
|
||||
$storage->setBackendOption('public_key_auth', $auth);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue