0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-02-14 21:09:20 +00:00
nextcloud_server/lib/public/Collaboration/Reference/IPublicReferenceProvider.php
Jonas 1671bf3ef2
feat(Reference): Add public API endpoints to get references
Calling the public API endpoints will check for matching registered
reference providers that implement `IPublicReferenceProvider` and call
their respective functions. If no matching provider is found, the
default `LinkReferenceProvider` will be used to provide open graph data.

The frontend reference widget components will call these endpoints from
unauthorized sessions, e.g. in public shares.

If present, the sharing token of the origin URL is passed to
`resolveReferencePublic()` as additional information for the reference
provider to determine the access scope. This allows the respective
reference providers to determine whether the origin share has access to
the linked resource.

`getCacheKeyPublic` also gets the sharing token so it can scope the cached
entry to it.

Contributes to #45978

Signed-off-by: Jonas <jonas@freesources.org>
2024-07-17 12:56:41 +02:00

33 lines
936 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Collaboration\Reference;
/**
* @since 30.0.0
*/
interface IPublicReferenceProvider extends IReferenceProvider {
/**
* Return a reference with its metadata for a given reference identifier and sharingToken
*
* @since 30.0.0
*/
public function resolveReferencePublic(string $referenceText, string $sharingToken): ?IReference;
/**
* Return a custom cache key to be used for caching the metadata
* This could be for example the current sharingToken if the reference
* access permissions are different for each share
*
* Should return null, if the cache is only related to the
* reference id and has no further dependency
*
* @since 30.0.0
*/
public function getCacheKeyPublic(string $referenceId, string $sharingToken): ?string;
}