Skip to content

Commit

Permalink
Correct typehint for Tokens::listScopes (#11)
Browse files Browse the repository at this point in the history
* Correct typehint for listScopes - the first argument is an array, not a string

* Add `array` to signature

* v0.1.4
  • Loading branch information
junglebarry authored Dec 20, 2018
1 parent fed70ab commit 6575497
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "talis/talis-php",
"description": "This is a php client library for talis api's",
"version": "0.1.3",
"version": "0.1.4",
"keywords": [
"persona",
"echo",
Expand Down
8 changes: 4 additions & 4 deletions src/Talis/Persona/Client/Tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,21 +225,21 @@ public function obtainNewToken($clientId, $clientSecret, array $params = [])

/**
* List all scopes that belong to a given token
* @param string $token JWT token
* @param array $tokenInArray An array containing a JWT under the key `access_token`
* @param integer $pubCertCacheTTL optional JWT public certificate time-to-live
* @return array list of scopes
*
* @throws TokenValidationException Invalid signature, key or token
*/
public function listScopes($token, $pubCertCacheTTL = 300)
public function listScopes(array $tokenInArray, $pubCertCacheTTL = 300)
{
if (!isset($token['access_token'])) {
if (!isset($tokenInArray['access_token'])) {
throw new TokenValidationException('missing access token');
}

$publicCert = $this->retrieveJWTCertificate($pubCertCacheTTL);

$encodedToken = $token['access_token'];
$encodedToken = $tokenInArray['access_token'];
$decodedToken = $this->decodeToken($encodedToken, $publicCert);

if (isset($decodedToken['scopes']) && is_array($decodedToken['scopes'])) {
Expand Down

0 comments on commit 6575497

Please sign in to comment.