mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 06:27:02 +03:00
Trying different sso type (PHP) for ownCloud package
This commit is contained in:
parent
777d014403
commit
1d39879765
12 changed files with 81 additions and 70 deletions
|
|
@ -703,6 +703,7 @@ class Utils
|
|||
'sql' => 'text/plain',
|
||||
'cfg' => 'text/plain',
|
||||
'conf' => 'text/plain',
|
||||
'asc' => 'text/plain',
|
||||
'rtx' => 'text/richtext',
|
||||
'vcard' => 'text/vcard',
|
||||
'vcf' => 'text/vcard',
|
||||
|
|
|
|||
|
|
@ -58,10 +58,11 @@ class CacheClient
|
|||
|
||||
/**
|
||||
* @param string $sKey
|
||||
* @param string $bClearAfterGet = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function Get($sKey)
|
||||
public function Get($sKey, $bClearAfterGet = false)
|
||||
{
|
||||
$sValue = '';
|
||||
|
||||
|
|
@ -70,6 +71,11 @@ class CacheClient
|
|||
$sValue = $this->oDriver->Get($sKey.$this->sCacheIndex);
|
||||
}
|
||||
|
||||
if ($bClearAfterGet)
|
||||
{
|
||||
$this->Delete($sKey);
|
||||
}
|
||||
|
||||
return $sValue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1620,18 +1620,16 @@ class Actions
|
|||
$oLogger = $this->Logger();
|
||||
$oLogger->Write('Trying to decode encrypted data', \MailSo\Log\Enumerations\Type::INFO, 'RSA');
|
||||
|
||||
$sPrivateKey = $this->Cacher()->Get('/Key/RSA/'.$aMatch[1].'/');
|
||||
$sPrivateKey = $this->Cacher()->Get(\RainLoop\KeyPathHelper::RsaCacherKey($aMatch[1]), true);
|
||||
if (!empty($sPrivateKey))
|
||||
{
|
||||
$this->Cacher()->Delete('/Key/RSA/'.$aMatch[1].'/');
|
||||
|
||||
$sData = \trim(\substr($sEncryptedData, 37));
|
||||
|
||||
if (!\class_exists('Crypt_RSA'))
|
||||
{
|
||||
\set_include_path(\get_include_path().PATH_SEPARATOR.APP_VERSION_ROOT_PATH.'app/libraries/phpseclib');
|
||||
include_once 'Crypt/RSA.php';
|
||||
\defined('CRYPT_RSA_MODE') || \define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL);
|
||||
include_once 'Crypt/RSA.php';
|
||||
}
|
||||
|
||||
\RainLoop\Service::$__HIDE_ERROR_NOTICES = true;
|
||||
|
|
@ -1677,8 +1675,8 @@ class Actions
|
|||
if (!\class_exists('Crypt_RSA'))
|
||||
{
|
||||
\set_include_path(\get_include_path().PATH_SEPARATOR.APP_VERSION_ROOT_PATH.'app/libraries/phpseclib');
|
||||
include_once 'Crypt/RSA.php';
|
||||
\defined('CRYPT_RSA_MODE') || \define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL);
|
||||
include_once 'Crypt/RSA.php';
|
||||
}
|
||||
|
||||
$oRsa = new \Crypt_RSA();
|
||||
|
|
@ -1694,7 +1692,8 @@ class Actions
|
|||
|
||||
\RainLoop\Service::$__HIDE_ERROR_NOTICES = false;
|
||||
return $this->DefaultResponse(__FUNCTION__,
|
||||
$this->Cacher()->Set('/Key/RSA/'.$sHash.'/', $aKeys['privatekey']) ? array($sHash, $e->toHex(), $n->toHex()) : false);
|
||||
$this->Cacher()->Set(\RainLoop\KeyPathHelper::RsaCacherKey($sHash), $aKeys['privatekey']) ?
|
||||
array($sHash, $e->toHex(), $n->toHex()) : false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,16 @@ class KeyPathHelper
|
|||
return '/Sso/Data/'.$sSsoHash.'/Login/';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sHash
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
static public function RsaCacherKey($sHash)
|
||||
{
|
||||
return '/Rsa/Data/'.$sHash.'/';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sSignMeToken
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue