aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Authentication/Token/Manager.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Authentication/Token/Manager.php')
-rw-r--r--lib/private/Authentication/Token/Manager.php34
1 files changed, 5 insertions, 29 deletions
diff --git a/lib/private/Authentication/Token/Manager.php b/lib/private/Authentication/Token/Manager.php
index 6953f47b004..95bea8bee19 100644
--- a/lib/private/Authentication/Token/Manager.php
+++ b/lib/private/Authentication/Token/Manager.php
@@ -1,6 +1,7 @@
<?php
declare(strict_types=1);
+
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -17,29 +18,23 @@ use OCP\Authentication\Token\IProvider as OCPIProvider;
use OCP\Authentication\Token\IToken as OCPIToken;
class Manager implements IProvider, OCPIProvider {
- /** @var PublicKeyTokenProvider */
- private $publicKeyTokenProvider;
- public function __construct(PublicKeyTokenProvider $publicKeyTokenProvider) {
- $this->publicKeyTokenProvider = $publicKeyTokenProvider;
+ public function __construct(
+ private PublicKeyTokenProvider $publicKeyTokenProvider,
+ ) {
}
/**
* Create and persist a new token
*
- * @param string $token
- * @param string $uid
- * @param string $loginName
- * @param string|null $password
* @param string $name Name will be trimmed to 120 chars when longer
- * @param int $type token type
* @param int $remember whether the session token should be used for remember-me
* @return OCPIToken
*/
public function generateToken(string $token,
string $uid,
string $loginName,
- $password,
+ ?string $password,
string $name,
int $type = OCPIToken::TEMPORARY_TOKEN,
int $remember = OCPIToken::DO_NOT_REMEMBER,
@@ -78,7 +73,6 @@ class Manager implements IProvider, OCPIProvider {
/**
* Save the updated token
*
- * @param OCPIToken $token
* @throws InvalidTokenException
*/
public function updateToken(OCPIToken $token) {
@@ -90,7 +84,6 @@ class Manager implements IProvider, OCPIProvider {
* Update token activity timestamp
*
* @throws InvalidTokenException
- * @param OCPIToken $token
*/
public function updateTokenActivity(OCPIToken $token) {
$provider = $this->getProvider($token);
@@ -98,7 +91,6 @@ class Manager implements IProvider, OCPIProvider {
}
/**
- * @param string $uid
* @return OCPIToken[]
*/
public function getTokenByUser(string $uid): array {
@@ -108,10 +100,8 @@ class Manager implements IProvider, OCPIProvider {
/**
* Get a token by token
*
- * @param string $tokenId
* @throws InvalidTokenException
* @throws \RuntimeException when OpenSSL reports a problem
- * @return OCPIToken
*/
public function getToken(string $tokenId): OCPIToken {
try {
@@ -128,9 +118,7 @@ class Manager implements IProvider, OCPIProvider {
/**
* Get a token by token id
*
- * @param int $tokenId
* @throws InvalidTokenException
- * @return OCPIToken
*/
public function getTokenById(int $tokenId): OCPIToken {
try {
@@ -145,10 +133,7 @@ class Manager implements IProvider, OCPIProvider {
}
/**
- * @param string $oldSessionId
- * @param string $sessionId
* @throws InvalidTokenException
- * @return OCPIToken
*/
public function renewSessionToken(string $oldSessionId, string $sessionId): OCPIToken {
try {
@@ -161,11 +146,8 @@ class Manager implements IProvider, OCPIProvider {
}
/**
- * @param OCPIToken $savedToken
- * @param string $tokenId session token
* @throws InvalidTokenException
* @throws PasswordlessTokenException
- * @return string
*/
public function getPassword(OCPIToken $savedToken, string $tokenId): string {
$provider = $this->getProvider($savedToken);
@@ -194,10 +176,6 @@ class Manager implements IProvider, OCPIProvider {
}
/**
- * @param OCPIToken $token
- * @param string $oldTokenId
- * @param string $newTokenId
- * @return OCPIToken
* @throws InvalidTokenException
* @throws \RuntimeException when OpenSSL reports a problem
*/
@@ -211,8 +189,6 @@ class Manager implements IProvider, OCPIProvider {
}
/**
- * @param OCPIToken $token
- * @return IProvider
* @throws InvalidTokenException
*/
private function getProvider(OCPIToken $token): IProvider {