/** * Implements FetchAuthTokenInterface#fetchAuthToken. * * @param callable $httpHandler * * @return array|void */ public function fetchAuthToken(callable $httpHandler = null) { $audience = $this->auth->getAudience(); if (empty($audience)) { return null; } $access_token = $this->auth->toJwt(); return array('access_token' => $access_token); }
public function testCanRS256EncodeAValidPayload() { $publicKey = file_get_contents(__DIR__ . '/fixtures' . '/public.pem'); $privateKey = file_get_contents(__DIR__ . '/fixtures' . '/private.pem'); $testConfig = $this->signingMinimal; $o = new OAuth2($testConfig); $o->setSigningAlgorithm('RS256'); $o->setSigningKey($privateKey); $payload = $o->toJwt(); $roundTrip = $this->jwtDecode($payload, $publicKey, array('RS256')); $this->assertEquals($roundTrip->iss, $testConfig['issuer']); $this->assertEquals($roundTrip->aud, $testConfig['audience']); $this->assertEquals($roundTrip->scope, $testConfig['scope']); }