1<?php 2 3declare(strict_types=1); 4 5/** 6 * @copyright Copyright (c) 2016, ownCloud, Inc. 7 * 8 * @author Christoph Wurst <christoph@winzerhof-wurst.at> 9 * @author Robin Appelman <robin@icewind.nl> 10 * @author Roeland Jago Douma <roeland@famdouma.nl> 11 * 12 * @license AGPL-3.0 13 * 14 * This code is free software: you can redistribute it and/or modify 15 * it under the terms of the GNU Affero General Public License, version 3, 16 * as published by the Free Software Foundation. 17 * 18 * This program is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * GNU Affero General Public License for more details. 22 * 23 * You should have received a copy of the GNU Affero General Public License, version 3, 24 * along with this program. If not, see <http://www.gnu.org/licenses/> 25 * 26 */ 27namespace OC\Authentication\Token; 28 29use JsonSerializable; 30 31interface IToken extends JsonSerializable { 32 public const TEMPORARY_TOKEN = 0; 33 public const PERMANENT_TOKEN = 1; 34 public const WIPE_TOKEN = 2; 35 public const DO_NOT_REMEMBER = 0; 36 public const REMEMBER = 1; 37 38 /** 39 * Get the token ID 40 * 41 * @return int 42 */ 43 public function getId(): int; 44 45 /** 46 * Get the user UID 47 * 48 * @return string 49 */ 50 public function getUID(): string; 51 52 /** 53 * Get the login name used when generating the token 54 * 55 * @return string 56 */ 57 public function getLoginName(): string; 58 59 /** 60 * Get the (encrypted) login password 61 * 62 * @return string|null 63 */ 64 public function getPassword(); 65 66 /** 67 * Get the timestamp of the last password check 68 * 69 * @return int 70 */ 71 public function getLastCheck(): int; 72 73 /** 74 * Set the timestamp of the last password check 75 * 76 * @param int $time 77 */ 78 public function setLastCheck(int $time); 79 80 /** 81 * Get the authentication scope for this token 82 * 83 * @return string 84 */ 85 public function getScope(): string; 86 87 /** 88 * Get the authentication scope for this token 89 * 90 * @return array 91 */ 92 public function getScopeAsArray(): array; 93 94 /** 95 * Set the authentication scope for this token 96 * 97 * @param array $scope 98 */ 99 public function setScope($scope); 100 101 /** 102 * Get the name of the token 103 * @return string 104 */ 105 public function getName(): string; 106 107 /** 108 * Get the remember state of the token 109 * 110 * @return int 111 */ 112 public function getRemember(): int; 113 114 /** 115 * Set the token 116 * 117 * @param string $token 118 */ 119 public function setToken(string $token); 120 121 /** 122 * Set the password 123 * 124 * @param string $password 125 */ 126 public function setPassword(string $password); 127 128 /** 129 * Set the expiration time of the token 130 * 131 * @param int|null $expires 132 */ 133 public function setExpires($expires); 134} 135