diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-02-12 11:26:46 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-02-25 09:24:50 +0300 |
commit | e819e97829407093fd704e70f9cb5964e3f24969 (patch) | |
tree | 347d8e3a8f776d4a46d3fc5954ddab1d23f02346 /core/Data | |
parent | 5df6400e287f5ba1c23dcd4749386d8bd2967d35 (diff) |
Login flow V2
This adds the new login flow. The desktop client will open up a browser
and poll a returned endpoint at regular intervals to check if the flow
is done.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'core/Data')
-rw-r--r-- | core/Data/LoginFlowV2Credentials.php | 71 | ||||
-rw-r--r-- | core/Data/LoginFlowV2Tokens.php | 47 |
2 files changed, 118 insertions, 0 deletions
diff --git a/core/Data/LoginFlowV2Credentials.php b/core/Data/LoginFlowV2Credentials.php new file mode 100644 index 00000000000..68dd772f9e0 --- /dev/null +++ b/core/Data/LoginFlowV2Credentials.php @@ -0,0 +1,71 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Core\Data; + +class LoginFlowV2Credentials implements \JsonSerializable { + /** @var string */ + private $server; + /** @var string */ + private $loginName; + /** @var string */ + private $appPassword; + + public function __construct(string $server, string $loginName, string $appPassword) { + $this->server = $server; + $this->loginName = $loginName; + $this->appPassword = $appPassword; + } + + /** + * @return string + */ + public function getServer(): string { + return $this->server; + } + + /** + * @return string + */ + public function getLoginName(): string { + return $this->loginName; + } + + /** + * @return string + */ + public function getAppPassword(): string { + return $this->appPassword; + } + + public function jsonSerialize(): array { + return [ + 'server' => $this->server, + 'loginName' => $this->loginName, + 'appPassword' => $this->appPassword, + ]; + } + + +} diff --git a/core/Data/LoginFlowV2Tokens.php b/core/Data/LoginFlowV2Tokens.php new file mode 100644 index 00000000000..e32278d2e7f --- /dev/null +++ b/core/Data/LoginFlowV2Tokens.php @@ -0,0 +1,47 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Core\Data; + +class LoginFlowV2Tokens { + + /** @var string */ + private $loginToken; + /** @var string */ + private $pollToken; + + public function __construct(string $loginToken, string $pollToken) { + $this->loginToken = $loginToken; + $this->pollToken = $pollToken; + } + + public function getPollToken(): string { + return $this->pollToken; + + } + + public function getLoginToken(): string { + return $this->loginToken; + } +} |