2015-08-24 18:13:16 +03:00
|
|
|
<?php
|
2021-04-19 16:50:30 +03:00
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2015-08-24 18:13:16 +03:00
|
|
|
/**
|
2016-07-21 18:07:57 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2020-04-29 12:57:22 +03:00
|
|
|
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
|
2016-03-01 19:25:15 +03:00
|
|
|
* @author Robin McCorkell <robin@mccorkell.me.uk>
|
2015-08-24 18:13:16 +03:00
|
|
|
*
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2015-08-24 18:13:16 +03: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 20:34:23 +03:00
|
|
|
* @param string $userId empty string for system-wide credentials
|
2015-08-24 18:13:16 +03:00
|
|
|
* @param string $identifier
|
|
|
|
* @param mixed $credentials
|
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2021-04-19 16:50:30 +03:00
|
|
|
public function store(string $userId, string $identifier, $credentials): void;
|
2015-08-24 18:13:16 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve a set of credentials
|
|
|
|
*
|
2020-04-15 20:34:23 +03:00
|
|
|
* @param string $userId empty string for system-wide credentials
|
2015-08-24 18:13:16 +03:00
|
|
|
* @param string $identifier
|
|
|
|
* @return mixed
|
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2021-04-19 16:50:30 +03:00
|
|
|
public function retrieve(string $userId, string $identifier);
|
2015-08-24 18:13:16 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete a set of credentials
|
|
|
|
*
|
2020-04-15 20:34:23 +03:00
|
|
|
* @param string $userId empty string for system-wide credentials
|
2015-08-24 18:13:16 +03:00
|
|
|
* @param string $identifier
|
|
|
|
* @return int rows removed
|
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2021-04-19 16:50:30 +03:00
|
|
|
public function delete(string $userId, string $identifier): int;
|
2015-08-24 18:13:16 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Erase all credentials stored for a user
|
|
|
|
*
|
|
|
|
* @param string $userId
|
|
|
|
* @return int rows removed
|
|
|
|
* @since 8.2.0
|
|
|
|
*/
|
2021-04-19 16:50:30 +03:00
|
|
|
public function erase(string $userId): int;
|
2015-08-24 18:13:16 +03:00
|
|
|
}
|