forked from LiveCarta/PayPal-PHP-SDK
Added Encryption to Caching
- Access Token is encrypted with Secret Key, and stored in file - Code to auto-update existing cache files to use encrypted token - Tests fixes accordingly
This commit is contained in:
@@ -48,9 +48,11 @@ class OAuthTokenCredentialTest extends \PHPUnit_Framework_TestCase
|
||||
'cache.enabled' => true,
|
||||
'cache.FileName' => AuthorizationCacheTest::CACHE_FILE
|
||||
);
|
||||
$cred = new OAuthTokenCredential('clientId', 'clientSecret');
|
||||
|
||||
//{"clientId":{"clientId":"clientId","accessToken":"accessToken","tokenCreateTime":1421204091,"tokenExpiresIn":288000000}}
|
||||
AuthorizationCache::push($config, 'clientId', 'accessToken', 1421204091, 288000000);
|
||||
$cred = new OAuthTokenCredential('clientId', 'clientSecret');
|
||||
AuthorizationCache::push($config, 'clientId', $cred->encrypt('accessToken'), 1421204091, 288000000);
|
||||
|
||||
$apiContext = new ApiContext($cred);
|
||||
$apiContext->setConfig($config);
|
||||
$this->assertEquals('clientId', $cred->getClientId());
|
||||
|
||||
Reference in New Issue
Block a user