2015-08-24 11:13:16 -04:00
|
|
|
<?php
|
2021-04-19 09:50:30 -04:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2015-08-24 11:13:16 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2015-08-24 11:13:16 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCP\Security;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Store and retrieve credentials for external services
|
|
|
|
|
*
|
|
|
|
|
* @since 8.2.0
|
|
|
|
|
*/
|
|
|
|
|
interface ICredentialsManager {
|
|
|
|
|
/**
|
|
|
|
|
* Store a set of credentials
|
|
|
|
|
*
|
2020-04-15 13:34:23 -04:00
|
|
|
* @param string $userId empty string for system-wide credentials
|
2015-08-24 11:13:16 -04:00
|
|
|
* @param string $identifier
|
|
|
|
|
* @param mixed $credentials
|
|
|
|
|
* @since 8.2.0
|
|
|
|
|
*/
|
2021-04-19 09:50:30 -04:00
|
|
|
public function store(string $userId, string $identifier, $credentials): void;
|
2015-08-24 11:13:16 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Retrieve a set of credentials
|
|
|
|
|
*
|
2020-04-15 13:34:23 -04:00
|
|
|
* @param string $userId empty string for system-wide credentials
|
2015-08-24 11:13:16 -04:00
|
|
|
* @param string $identifier
|
|
|
|
|
* @return mixed
|
|
|
|
|
* @since 8.2.0
|
|
|
|
|
*/
|
2021-04-19 09:50:30 -04:00
|
|
|
public function retrieve(string $userId, string $identifier);
|
2015-08-24 11:13:16 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Delete a set of credentials
|
|
|
|
|
*
|
2020-04-15 13:34:23 -04:00
|
|
|
* @param string $userId empty string for system-wide credentials
|
2015-08-24 11:13:16 -04:00
|
|
|
* @param string $identifier
|
|
|
|
|
* @return int rows removed
|
|
|
|
|
* @since 8.2.0
|
|
|
|
|
*/
|
2021-04-19 09:50:30 -04:00
|
|
|
public function delete(string $userId, string $identifier): int;
|
2015-08-24 11:13:16 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Erase all credentials stored for a user
|
|
|
|
|
*
|
|
|
|
|
* @param string $userId
|
|
|
|
|
* @return int rows removed
|
|
|
|
|
* @since 8.2.0
|
|
|
|
|
*/
|
2021-04-19 09:50:30 -04:00
|
|
|
public function erase(string $userId): int;
|
2015-08-24 11:13:16 -04:00
|
|
|
}
|