Merge pull request #16452 from nextcloud/bug/noid/error-with-exception-on-ssl-error
Error with exception on SSL error
This commit is contained in:
commit
baff2ccdba
|
@ -45,6 +45,7 @@ interface IProvider {
|
||||||
* @param int $type token type
|
* @param int $type token type
|
||||||
* @param int $remember whether the session token should be used for remember-me
|
* @param int $remember whether the session token should be used for remember-me
|
||||||
* @return IToken
|
* @return IToken
|
||||||
|
* @throws \RuntimeException when OpenSSL reports a problem
|
||||||
*/
|
*/
|
||||||
public function generateToken(string $token,
|
public function generateToken(string $token,
|
||||||
string $uid,
|
string $uid,
|
||||||
|
@ -82,6 +83,7 @@ interface IProvider {
|
||||||
* @param string $oldSessionId
|
* @param string $oldSessionId
|
||||||
* @param string $sessionId
|
* @param string $sessionId
|
||||||
* @throws InvalidTokenException
|
* @throws InvalidTokenException
|
||||||
|
* @throws \RuntimeException when OpenSSL reports a problem
|
||||||
*/
|
*/
|
||||||
public function renewSessionToken(string $oldSessionId, string $sessionId);
|
public function renewSessionToken(string $oldSessionId, string $sessionId);
|
||||||
|
|
||||||
|
@ -158,6 +160,7 @@ interface IProvider {
|
||||||
* @param string $oldTokenId
|
* @param string $oldTokenId
|
||||||
* @param string $newTokenId
|
* @param string $newTokenId
|
||||||
* @return IToken
|
* @return IToken
|
||||||
|
* @throws \RuntimeException when OpenSSL reports a problem
|
||||||
*/
|
*/
|
||||||
public function rotate(IToken $token, string $oldTokenId, string $newTokenId): IToken;
|
public function rotate(IToken $token, string $oldTokenId, string $newTokenId): IToken;
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ class Manager implements IProvider {
|
||||||
*
|
*
|
||||||
* @param string $tokenId
|
* @param string $tokenId
|
||||||
* @throws InvalidTokenException
|
* @throws InvalidTokenException
|
||||||
|
* @throws \RuntimeException when OpenSSL reports a problem
|
||||||
* @return IToken
|
* @return IToken
|
||||||
*/
|
*/
|
||||||
public function getToken(string $tokenId): IToken {
|
public function getToken(string $tokenId): IToken {
|
||||||
|
@ -206,6 +207,7 @@ class Manager implements IProvider {
|
||||||
* @param string $newTokenId
|
* @param string $newTokenId
|
||||||
* @return IToken
|
* @return IToken
|
||||||
* @throws InvalidTokenException
|
* @throws InvalidTokenException
|
||||||
|
* @throws \RuntimeException when OpenSSL reports a problem
|
||||||
*/
|
*/
|
||||||
public function rotate(IToken $token, string $oldTokenId, string $newTokenId): IToken {
|
public function rotate(IToken $token, string $oldTokenId, string $newTokenId): IToken {
|
||||||
if ($token instanceof DefaultToken) {
|
if ($token instanceof DefaultToken) {
|
||||||
|
|
|
@ -61,6 +61,9 @@ class PublicKeyTokenProvider implements IProvider {
|
||||||
$this->time = $time;
|
$this->time = $time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
public function generateToken(string $token,
|
public function generateToken(string $token,
|
||||||
string $uid,
|
string $uid,
|
||||||
string $loginName,
|
string $loginName,
|
||||||
|
@ -268,6 +271,7 @@ class PublicKeyTokenProvider implements IProvider {
|
||||||
/**
|
/**
|
||||||
* Convert a DefaultToken to a publicKeyToken
|
* Convert a DefaultToken to a publicKeyToken
|
||||||
* This will also be updated directly in the Database
|
* 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 {
|
public function convertToken(DefaultToken $defaultToken, string $token, $password): PublicKeyToken {
|
||||||
$pkToken = $this->newToken(
|
$pkToken = $this->newToken(
|
||||||
|
@ -286,6 +290,9 @@ class PublicKeyTokenProvider implements IProvider {
|
||||||
return $this->mapper->update($pkToken);
|
return $this->mapper->update($pkToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \RuntimeException when OpenSSL reports a problem
|
||||||
|
*/
|
||||||
private function newToken(string $token,
|
private function newToken(string $token,
|
||||||
string $uid,
|
string $uid,
|
||||||
string $loginName,
|
string $loginName,
|
||||||
|
@ -306,6 +313,7 @@ class PublicKeyTokenProvider implements IProvider {
|
||||||
$res = openssl_pkey_new($config);
|
$res = openssl_pkey_new($config);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
$this->logOpensslError();
|
$this->logOpensslError();
|
||||||
|
throw new \RuntimeException('OpenSSL reported a problem');
|
||||||
}
|
}
|
||||||
|
|
||||||
openssl_pkey_export($res, $privateKey);
|
openssl_pkey_export($res, $privateKey);
|
||||||
|
|
Loading…
Reference in New Issue