Use the new access token covertToJWT method

This commit is contained in:
Alex Bilbie 2016-02-22 07:58:59 +00:00
parent ad270f7d9d
commit 0d0aaa8764

View File

@ -29,16 +29,7 @@ class BearerTokenResponse extends AbstractResponseType
{
$expireDateTime = $this->accessToken->getExpiryDateTime()->getTimestamp();
$jwtAccessToken = (new Builder())
->setAudience($this->accessToken->getClient()->getIdentifier())
->setId($this->accessToken->getIdentifier(), true)
->setIssuedAt(time())
->setNotBefore(time())
->setExpiration($expireDateTime)
->setSubject($this->accessToken->getUserIdentifier())
->set('scopes', $this->accessToken->getScopes())
->sign(new Sha256(), new Key($this->pathToPrivateKey))
->getToken();
$jwtAccessToken = $this->accessToken->convertToJWT($this->pathToPrivateKey);
$responseParams = [
'token_type' => 'Bearer',