refactor: migrate to scoped execution contexts

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-07-27 00:50:43 -04:00
parent edc1aece13
commit 8af08d8936
2 changed files with 5 additions and 8 deletions
+1 -1
View File
@@ -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');
}
+4 -7
View File
@@ -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';