diff options
author | Robin Appelman <icewind@owncloud.com> | 2016-08-03 12:03:18 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2016-11-16 15:24:27 +0100 |
commit | b4e27d35f59e359eb7591a15c7f037968081eb1b (patch) | |
tree | 3c156c70ef7fc3de6f79aace60f715e999e19d29 /lib | |
parent | 2389e0f25065ca9c7afbc70cc13d555524e363a8 (diff) | |
download | nextcloud-server-b4e27d35f59e359eb7591a15c7f037968081eb1b.tar.gz nextcloud-server-b4e27d35f59e359eb7591a15c7f037968081eb1b.zip |
app password scope wip
Signed-off-by: Robin Appelman <icewind@owncloud.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Authentication/Token/DefaultToken.php | 6 | ||||
-rw-r--r-- | lib/private/Authentication/Token/DefaultTokenMapper.php | 1 | ||||
-rw-r--r-- | lib/private/Authentication/Token/IToken.php | 14 |
3 files changed, 19 insertions, 2 deletions
diff --git a/lib/private/Authentication/Token/DefaultToken.php b/lib/private/Authentication/Token/DefaultToken.php index 0c45c9efa56..e938ff92e16 100644 --- a/lib/private/Authentication/Token/DefaultToken.php +++ b/lib/private/Authentication/Token/DefaultToken.php @@ -151,6 +151,10 @@ class DefaultToken extends Entity implements IToken { } public function setScope($scope) { - return parent::setScope(json_encode($scope)); + if (is_string($scope)) { + $this->scope = $scope; + } else { + return parent::setScope(json_encode($scope)); + } } } diff --git a/lib/private/Authentication/Token/DefaultTokenMapper.php b/lib/private/Authentication/Token/DefaultTokenMapper.php index e2a17ca0f91..bfcb54c66c0 100644 --- a/lib/private/Authentication/Token/DefaultTokenMapper.php +++ b/lib/private/Authentication/Token/DefaultTokenMapper.php @@ -83,6 +83,7 @@ class DefaultTokenMapper extends Mapper { if ($data === false) { throw new DoesNotExistException('token does not exist'); } +; return DefaultToken::fromRow($data); } diff --git a/lib/private/Authentication/Token/IToken.php b/lib/private/Authentication/Token/IToken.php index 3fa8ccbb078..a6ba392907d 100644 --- a/lib/private/Authentication/Token/IToken.php +++ b/lib/private/Authentication/Token/IToken.php @@ -67,13 +67,25 @@ interface IToken extends JsonSerializable { public function getLastCheck(); /** - * Get the timestamp of the last password check + * Set the timestamp of the last password check * * @param int $time */ public function setLastCheck($time); + /** + * Get the authentication scope for this token + * + * If the scope is null no limitations exist for the token + * + * @return array|null + */ public function getScope(); + /** + * Set the authentication scope for this token + * + * @param array|null $scope + */ public function setScope($scope); } |