Пример #1
0
 public function testOrgFid()
 {
     $provider = new FortifiProvider();
     $provider->setOrgFid('ORG-12');
     $this->assertEquals('ORG-12', $provider->getOrgFid());
     $headers = $provider->getHeaders();
     $this->assertArrayHasKey('X-Fortifi-Org', $headers);
     $this->assertEquals('ORG-12', $headers['X-Fortifi-Org']);
 }
Пример #2
0
 public function getToken($fresh = false)
 {
     if ($fresh || $this->_token === null) {
         $token = $fresh ? null : $this->_tokenStorage->retrieveToken($this->_tokenKey);
         if (empty($token)) {
             $token = $this->_oAuthProvider->getAccessToken(new ServiceAccountGrant($this->_apiUser, $this->_apiKey), ['source' => 'fortifi.sdk.php']);
             $this->_tokenStorage->storeToken($this->_tokenKey, $token);
         }
         $this->_token = $token;
     }
     return new FortifiAccessToken(['access_token' => $this->_token]);
 }