Skip to content

Commit

Permalink
Merge pull request #70 from bshaffer/issue-68
Browse files Browse the repository at this point in the history
Issue 68 - make CredentialsLoader abstract
  • Loading branch information
tbetbetbe committed Sep 17, 2015
2 parents f9afd73 + 1322b2d commit 6ddd5a0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
19 changes: 1 addition & 18 deletions src/CredentialsLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* CredentialsLoader contains the behaviour used to locate and find default
* credentials files on the file system.
*/
class CredentialsLoader implements FetchAuthTokenInterface
abstract class CredentialsLoader implements FetchAuthTokenInterface
{
const TOKEN_CREDENTIAL_URI = 'https://www.googleapis.com/oauth2/v3/token';
const ENV_VAR = 'GOOGLE_APPLICATION_CREDENTIALS';
Expand Down Expand Up @@ -138,23 +138,6 @@ public static function makeCredentials($scope, Stream $jsonKeyStream)
}
}

/**
* Implements FetchAuthTokenInterface#fetchAuthToken.
*/
public function fetchAuthToken(ClientInterface $client = null)
{
return $this->auth->fetchAuthToken($client);
}

/**
* Implements FetchAuthTokenInterface#getCacheKey.
*/
public function getCacheKey()
{
return $this->auth->getCacheKey();
}


/**
* export a callback function which updates runtime metadata
*
Expand Down
8 changes: 8 additions & 0 deletions src/ServiceAccountCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ public function __construct($scope, $jsonKey,
]);
}

/**
* Implements FetchAuthTokenInterface#fetchAuthToken.
*/
public function fetchAuthToken(ClientInterface $client = null)
{
return $this->auth->fetchAuthToken($client);
}

/**
* Implements FetchAuthTokenInterface#getCacheKey.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/ServiceAccountJwtAccessCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,12 @@ public function fetchAuthToken(ClientInterface $unusedClient = null)
$access_token = $this->auth->toJwt();
return array('access_token' => $access_token);
}

/**
* Implements FetchAuthTokenInterface#getCacheKey.
*/
public function getCacheKey()
{
return $this->auth->getCacheKey();
}
}
8 changes: 8 additions & 0 deletions src/UserRefreshCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ public function __construct($scope, $jsonKey,
]);
}

/**
* Implements FetchAuthTokenInterface#fetchAuthToken.
*/
public function fetchAuthToken(ClientInterface $client = null)
{
return $this->auth->fetchAuthToken($client);
}

/**
* Implements FetchAuthTokenInterface#getCacheKey.
*/
Expand Down

0 comments on commit 6ddd5a0

Please sign in to comment.