diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2019-01-21 20:45:27 +0100 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2019-02-02 20:21:57 +0100 |
commit | 34e849d7024ed46568b7829782f602ae7d958abe (patch) | |
tree | 9001d1f39b24843b01a0e081c4a02f66b55a77c4 /lib | |
parent | db49e0fdae4d32324e623073d24adfbc6e0a4ac6 (diff) | |
download | nextcloud-server-34e849d7024ed46568b7829782f602ae7d958abe.tar.gz nextcloud-server-34e849d7024ed46568b7829782f602ae7d958abe.zip |
Add interface INamedToken
Remove $token instanceof DefaultToken || $token instanceof PublicKeyToken
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Authentication/Token/DefaultToken.php | 7 | ||||
-rw-r--r-- | lib/private/Authentication/Token/INamedToken.php | 34 | ||||
-rw-r--r-- | lib/private/Authentication/Token/PublicKeyToken.php | 7 |
3 files changed, 44 insertions, 4 deletions
diff --git a/lib/private/Authentication/Token/DefaultToken.php b/lib/private/Authentication/Token/DefaultToken.php index 85ea0dc4cdd..b1095d0a23b 100644 --- a/lib/private/Authentication/Token/DefaultToken.php +++ b/lib/private/Authentication/Token/DefaultToken.php @@ -30,7 +30,6 @@ use OCP\AppFramework\Db\Entity; * @method void setId(int $id) * @method void setUid(string $uid); * @method void setLoginName(string $loginname) - * @method void setName(string $name) * @method string getToken() * @method void setType(int $type) * @method int getType() @@ -39,7 +38,7 @@ use OCP\AppFramework\Db\Entity; * @method int getLastActivity() * @method void setVersion(int $version) */ -class DefaultToken extends Entity implements IToken { +class DefaultToken extends Entity implements INamedToken { const VERSION = 1; @@ -179,6 +178,10 @@ class DefaultToken extends Entity implements IToken { return parent::getName(); } + public function setName(string $name): void { + parent::setName($name); + } + public function getRemember(): int { return parent::getRemember(); } diff --git a/lib/private/Authentication/Token/INamedToken.php b/lib/private/Authentication/Token/INamedToken.php new file mode 100644 index 00000000000..ede075a21c0 --- /dev/null +++ b/lib/private/Authentication/Token/INamedToken.php @@ -0,0 +1,34 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2019, Daniel Kesselberg (mail@danielkesselberg.de) + * + * @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\Authentication\Token; + + +interface INamedToken extends IToken { + /** + * Set token name + * + * @param string $name + * @return void + */ + public function setName(string $name): void; +}
\ No newline at end of file diff --git a/lib/private/Authentication/Token/PublicKeyToken.php b/lib/private/Authentication/Token/PublicKeyToken.php index b6f55146707..b3d87fea7ea 100644 --- a/lib/private/Authentication/Token/PublicKeyToken.php +++ b/lib/private/Authentication/Token/PublicKeyToken.php @@ -31,7 +31,6 @@ use OCP\AppFramework\Db\Entity; * @method void setId(int $id) * @method void setUid(string $uid); * @method void setLoginName(string $loginname) - * @method void setName(string $name) * @method string getToken() * @method void setType(int $type) * @method int getType() @@ -45,7 +44,7 @@ use OCP\AppFramework\Db\Entity; * @method void setVersion(int $version) * @method bool getPasswordInvalid() */ -class PublicKeyToken extends Entity implements IToken { +class PublicKeyToken extends Entity implements INamedToken { const VERSION = 2; @@ -197,6 +196,10 @@ class PublicKeyToken extends Entity implements IToken { return parent::getName(); } + public function setName(string $name): void { + parent::setName($name); + } + public function getRemember(): int { return parent::getRemember(); } |