summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-07-18 20:51:30 +0200
committerGitHub <noreply@github.com>2019-07-18 20:51:30 +0200
commitbaff2ccdba684e5c412d87e4648158e73265fc41 (patch)
treed5396ce4b66f06fe66774a89c8cfd77411582ce1
parent3011449f17d99fc065bac952fad00658bf0959d6 (diff)
parent4ae17427c5c7693da87d57c90c0c249994d4b69a (diff)
downloadnextcloud-server-baff2ccdba684e5c412d87e4648158e73265fc41.tar.gz
nextcloud-server-baff2ccdba684e5c412d87e4648158e73265fc41.zip
Merge pull request #16452 from nextcloud/bug/noid/error-with-exception-on-ssl-error
Error with exception on SSL error
-rw-r--r--lib/private/Authentication/Token/IProvider.php3
-rw-r--r--lib/private/Authentication/Token/Manager.php2
-rw-r--r--lib/private/Authentication/Token/PublicKeyTokenProvider.php8
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/private/Authentication/Token/IProvider.php b/lib/private/Authentication/Token/IProvider.php
index e4403196583..860b93e16c2 100644
--- a/lib/private/Authentication/Token/IProvider.php
+++ b/lib/private/Authentication/Token/IProvider.php
@@ -45,6 +45,7 @@ interface IProvider {
* @param int $type token type
* @param int $remember whether the session token should be used for remember-me
* @return IToken
+ * @throws \RuntimeException when OpenSSL reports a problem
*/
public function generateToken(string $token,
string $uid,
@@ -82,6 +83,7 @@ interface IProvider {
* @param string $oldSessionId
* @param string $sessionId
* @throws InvalidTokenException
+ * @throws \RuntimeException when OpenSSL reports a problem
*/
public function renewSessionToken(string $oldSessionId, string $sessionId);
@@ -158,6 +160,7 @@ interface IProvider {
* @param string $oldTokenId
* @param string $newTokenId
* @return IToken
+ * @throws \RuntimeException when OpenSSL reports a problem
*/
public function rotate(IToken $token, string $oldTokenId, string $newTokenId): IToken;
diff --git a/lib/private/Authentication/Token/Manager.php b/lib/private/Authentication/Token/Manager.php
index c49bd1b1e19..76c0dfb8695 100644
--- a/lib/private/Authentication/Token/Manager.php
+++ b/lib/private/Authentication/Token/Manager.php
@@ -109,6 +109,7 @@ class Manager implements IProvider {
*
* @param string $tokenId
* @throws InvalidTokenException
+ * @throws \RuntimeException when OpenSSL reports a problem
* @return IToken
*/
public function getToken(string $tokenId): IToken {
@@ -206,6 +207,7 @@ class Manager implements IProvider {
* @param string $newTokenId
* @return IToken
* @throws InvalidTokenException
+ * @throws \RuntimeException when OpenSSL reports a problem
*/
public function rotate(IToken $token, string $oldTokenId, string $newTokenId): IToken {
if ($token instanceof DefaultToken) {
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
index 6e6d7acf242..adc4b4bed38 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
@@ -61,6 +61,9 @@ class PublicKeyTokenProvider implements IProvider {
$this->time = $time;
}
+ /**
+ * {@inheritDoc}
+ */
public function generateToken(string $token,
string $uid,
string $loginName,
@@ -268,6 +271,7 @@ class PublicKeyTokenProvider implements IProvider {
/**
* Convert a DefaultToken to a publicKeyToken
* This will also be updated directly in the Database
+ * @throws \RuntimeException when OpenSSL reports a problem
*/
public function convertToken(DefaultToken $defaultToken, string $token, $password): PublicKeyToken {
$pkToken = $this->newToken(
@@ -286,6 +290,9 @@ class PublicKeyTokenProvider implements IProvider {
return $this->mapper->update($pkToken);
}
+ /**
+ * @throws \RuntimeException when OpenSSL reports a problem
+ */
private function newToken(string $token,
string $uid,
string $loginName,
@@ -306,6 +313,7 @@ class PublicKeyTokenProvider implements IProvider {
$res = openssl_pkey_new($config);
if ($res === false) {
$this->logOpensslError();
+ throw new \RuntimeException('OpenSSL reported a problem');
}
openssl_pkey_export($res, $privateKey);