refactor: migrate to scoped execution contexts
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -97,7 +97,7 @@ class Provider implements IProviderBase, IProviderServiceMutate
|
||||
}
|
||||
|
||||
// Note: This simplified interface doesn't pass tenantId
|
||||
// Will need to get it from SessionTenant in actual implementation
|
||||
// Will need to get it from TenantContextInterface in actual implementation
|
||||
throw new \RuntimeException('Use Mail Provider interface for service creation');
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ use GuzzleHttp\Client as HttpClient;
|
||||
use GuzzleHttp\Psr7\HttpFactory;
|
||||
use JmapClient\Authentication\Basic;
|
||||
use JmapClient\Client as JmapClient;
|
||||
use KTXC\Server;
|
||||
use KTXF\Security\Crypto;
|
||||
use KTXF\Resource\Provider\ResourceServiceIdentityBasic;
|
||||
use KTXF\Resource\Provider\ResourceServiceLocationUri;
|
||||
use KTXM\ProviderJmapc\Providers\Mail\Service as MailService;
|
||||
@@ -73,8 +73,7 @@ class RemoteService {
|
||||
}
|
||||
// debugging
|
||||
if ($service->getDebug()) {
|
||||
$logDir = Server::getInstance()?->logDir();
|
||||
$logDir .= '/jmap/' . $service->identifier() . '.json';
|
||||
$logDir = dirname(__DIR__, 5) . '/var/log/jmap/' . $service->identifier() . '.json';
|
||||
$client->configureTransportLogState(true);
|
||||
$client->configureTransportLogLocation($logDir);
|
||||
}
|
||||
@@ -200,7 +199,7 @@ class RemoteService {
|
||||
return $service;
|
||||
}
|
||||
|
||||
public static function cookieStoreRetrieve(mixed $id): ?array {
|
||||
public static function cookieStoreRetrieve(mixed $id, Crypto $crypto): ?array {
|
||||
|
||||
$file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . (string)$id . '.jmapc';
|
||||
|
||||
@@ -209,7 +208,6 @@ class RemoteService {
|
||||
}
|
||||
|
||||
$data = file_get_contents($file);
|
||||
$crypto = Server::getInstance()->container()->get(\KTXF\Security\Crypto::class);
|
||||
$data = $crypto->decrypt($data);
|
||||
|
||||
if (!empty($data)) {
|
||||
@@ -220,13 +218,12 @@ class RemoteService {
|
||||
|
||||
}
|
||||
|
||||
public static function cookieStoreDeposit(mixed $id, array $value): void {
|
||||
public static function cookieStoreDeposit(mixed $id, array $value, Crypto $crypto): void {
|
||||
|
||||
if (empty($value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$crypto = Server::getInstance()->container()->get(\KTXF\Security\Crypto::class);
|
||||
$data = $crypto->encrypt(json_encode($value));
|
||||
|
||||
$file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . (string)$id . '.jmapc';
|
||||
|
||||
Reference in New Issue
Block a user