Ejemplo n.º 1
0
 public function testShouldBeTheSameAsOAuth2WithTheSameScope()
 {
     $testJson = createURCTestJson();
     $scope = ['scope/1', 'scope/2'];
     $sa = new UserRefreshCredentials($scope, $testJson);
     $o = new OAuth2(['scope' => $scope]);
     $this->assertSame($testJson['client_id'] . ':' . $o->getCacheKey(), $sa->getCacheKey());
 }
 /**
  * @return string
  */
 public function getCacheKey()
 {
     $key = $this->auth->getIssuer() . ':' . $this->auth->getCacheKey();
     if ($sub = $this->auth->getSub()) {
         $key .= ':' . $sub;
     }
     return $key;
 }
 public function testShouldBeTheSameAsOAuth2WithTheSameScopeWithSub()
 {
     $testJson = createTestJson();
     $scope = ['scope/1', 'scope/2'];
     $sub = 'sub123';
     $sa = new ServiceAccountCredentials($scope, $testJson, null, $sub);
     $o = new OAuth2(['scope' => $scope]);
     $this->assertSame($testJson['client_email'] . ':' . $o->getCacheKey() . ':' . $sub, $sa->getCacheKey());
 }
 /**
  * @return string
  */
 public function getCacheKey()
 {
     return $this->auth->getCacheKey();
 }
Ejemplo n.º 5
0
 public function testIsAllScopesWhenScopeIsArray()
 {
     $o = new OAuth2($this->minimal);
     $o->setScope(['test/scope/1', 'test/scope/2']);
     $this->assertEquals('test/scope/1:test/scope/2', $o->getCacheKey());
 }
 /**
  * @return string
  */
 public function getCacheKey()
 {
     return $this->auth->getClientId() . ':' . $this->auth->getCacheKey();
 }