diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2024-12-02 11:30:37 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2024-12-04 09:30:55 -0100 |
commit | 948547bd5dbd181122333b8636f094638b036b39 (patch) | |
tree | 60c4f94ecf46f8805120c17064b0211aed01e8d0 /lib/private/OCM | |
parent | 4b0662005582e7a502b0de8e5e7e52f1675f3809 (diff) | |
download | nextcloud-server-948547bd5dbd181122333b8636f094638b036b39.tar.gz nextcloud-server-948547bd5dbd181122333b8636f094638b036b39.zip |
fix(ocm): signatory mapper
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/private/OCM')
-rw-r--r-- | lib/private/OCM/Model/OCMProvider.php | 4 | ||||
-rw-r--r-- | lib/private/OCM/OCMSignatoryManager.php | 21 |
2 files changed, 21 insertions, 4 deletions
diff --git a/lib/private/OCM/Model/OCMProvider.php b/lib/private/OCM/Model/OCMProvider.php index 32068efe3eb..fb13b7c0f93 100644 --- a/lib/private/OCM/Model/OCMProvider.php +++ b/lib/private/OCM/Model/OCMProvider.php @@ -183,7 +183,9 @@ class OCMProvider implements IOCMProvider { $this->setResourceTypes($resources); // import details about the remote request signing public key, if available - $signatory = new Signatory($data['publicKey']['keyId'] ?? '', $data['publicKey']['publicKeyPem'] ?? ''); + $signatory = new Signatory(); + $signatory->setKeyId($data['publicKey']['keyId'] ?? ''); + $signatory->setPublicKey($data['publicKey']['publicKeyPem'] ?? ''); if ($signatory->getKeyId() !== '' && $signatory->getPublicKey() !== '') { $this->setSignatory($signatory); } diff --git a/lib/private/OCM/OCMSignatoryManager.php b/lib/private/OCM/OCMSignatoryManager.php index 909952a6b37..6b6917bcd4b 100644 --- a/lib/private/OCM/OCMSignatoryManager.php +++ b/lib/private/OCM/OCMSignatoryManager.php @@ -9,7 +9,9 @@ declare(strict_types=1); namespace OC\OCM; +use NCU\Security\Signature\Enum\DigestAlgorithm; use NCU\Security\Signature\Enum\SignatoryType; +use NCU\Security\Signature\Enum\SignatureAlgorithm; use NCU\Security\Signature\Exceptions\IdentityNotFoundException; use NCU\Security\Signature\ISignatoryManager; use NCU\Security\Signature\ISignatureManager; @@ -61,7 +63,15 @@ class OCMSignatoryManager implements ISignatoryManager { * @since 31.0.0 */ public function getOptions(): array { - return []; + return [ + 'algorithm' => SignatureAlgorithm::RSA_SHA512, + 'digestAlgorithm' => DigestAlgorithm::SHA512, + 'extraSignatureHeaders' => [], + 'ttl' => 300, + 'dateHeader' => 'D, d M Y H:i:s T', + 'ttlSignatory' => 86400 * 3, + 'bodyMaxSize' => 50000, + ]; } /** @@ -92,7 +102,12 @@ class OCMSignatoryManager implements ISignatoryManager { } $keyPair = $this->identityProofManager->getAppKey('core', 'ocm_external'); - return new Signatory($keyId, $keyPair->getPublic(), $keyPair->getPrivate(), local: true); + $signatory = new Signatory(true); + $signatory->setKeyId($keyId); + $signatory->setPublicKey($keyPair->getPublic()); + $signatory->setPrivateKey($keyPair->getPrivate()); + return $signatory; + } /** @@ -148,7 +163,7 @@ class OCMSignatoryManager implements ISignatoryManager { public function getRemoteSignatoryFromHost(string $host): ?Signatory { $ocmProvider = $this->ocmDiscoveryService->discover($host, true); $signatory = $ocmProvider->getSignatory(); - $signatory?->setType(SignatoryType::TRUSTED); + $signatory?->setSignatoryType(SignatoryType::TRUSTED); return $signatory; } } |