diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2024-11-28 14:21:34 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2024-12-04 09:30:55 -0100 |
commit | 4b0662005582e7a502b0de8e5e7e52f1675f3809 (patch) | |
tree | b58732f585e5c33384f487e8067f59862771f198 /lib/unstable/Security/Signature/IOutgoingSignedRequest.php | |
parent | 862a41111855314a9bf0d186ed02688386b70d73 (diff) | |
download | nextcloud-server-4b0662005582e7a502b0de8e5e7e52f1675f3809.tar.gz nextcloud-server-4b0662005582e7a502b0de8e5e7e52f1675f3809.zip |
feat(signatory): switch to qbmapper
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/unstable/Security/Signature/IOutgoingSignedRequest.php')
-rw-r--r-- | lib/unstable/Security/Signature/IOutgoingSignedRequest.php | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/lib/unstable/Security/Signature/IOutgoingSignedRequest.php b/lib/unstable/Security/Signature/IOutgoingSignedRequest.php new file mode 100644 index 00000000000..de2ab7e276d --- /dev/null +++ b/lib/unstable/Security/Signature/IOutgoingSignedRequest.php @@ -0,0 +1,106 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace NCU\Security\Signature; + +use NCU\Security\Signature\Enum\SignatureAlgorithm; +use NCU\Security\Signature\Exceptions\SignatoryException; +use NCU\Security\Signature\Exceptions\SignatoryNotFoundException; + +/** + * extends ISignedRequest to add info requested at the generation of the signature + * + * @see ISignatureManager for details on signature + * @experimental 31.0.0 + * @since 31.0.0 + */ +interface IOutgoingSignedRequest extends ISignedRequest { + /** + * set the host of the recipient of the request. + * + * @param string $host + * @return self + * @since 31.0.0 + */ + public function setHost(string $host): self; + + /** + * get the host of the recipient of the request. + * - on incoming request, this is the local hostname of current instance. + * - on outgoing request, this is the remote instance. + * + * @return string + * @since 31.0.0 + */ + public function getHost(): string; + + /** + * add a key/value pair to the headers of the request + * + * @param string $key + * @param string|int|float $value + * + * @return self + * @since 31.0.0 + */ + public function addHeader(string $key, string|int|float $value): self; + + /** + * returns list of headers value that will be added to the base request + * + * @return array + * @since 31.0.0 + */ + public function getHeaders(): array; + + /** + * set the ordered list of used headers in the Signature + * + * @param list<string> $list + * + * @return self + * @since 31.0.0 + */ + public function setHeaderList(array $list): self; + + /** + * returns ordered list of used headers in the Signature + * + * @return list<string> + * @since 31.0.0 + */ + public function getHeaderList(): array; + + /** + * set algorithm to be used to sign the signature + * + * @param SignatureAlgorithm $algorithm + * + * @return self + * @since 31.0.0 + */ + public function setAlgorithm(SignatureAlgorithm $algorithm): self; + + /** + * returns the algorithm set to sign the signature + * + * @return SignatureAlgorithm + * @since 31.0.0 + */ + public function getAlgorithm(): SignatureAlgorithm; + + /** + * sign outgoing request providing a certificate that it emanate from this instance + * + * @return self + * @throws SignatoryException + * @throws SignatoryNotFoundException + * @since 31.0.0 + */ + public function sign(): self; +} |