From a9313e76d4d6e38dad14b99d51a989e43f4a2ba0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Tue, 12 Jan 2016 22:56:10 +0000 Subject: [PATCH] Removed old JsonWebTokenType response as all tokens are JWTs now --- src/ResponseTypes/JsonWebTokenType.php | 125 ------------------------- 1 file changed, 125 deletions(-) delete mode 100644 src/ResponseTypes/JsonWebTokenType.php diff --git a/src/ResponseTypes/JsonWebTokenType.php b/src/ResponseTypes/JsonWebTokenType.php deleted file mode 100644 index 7ea5051a..00000000 --- a/src/ResponseTypes/JsonWebTokenType.php +++ /dev/null @@ -1,125 +0,0 @@ - $this->accessToken->getIdentifier(), - 'token_type' => 'Bearer', - 'expires_in' => $this->accessToken->getExpiryDateTime()->getTimestamp() - (new \DateTime())->getTimestamp() - ]; - - if (!is_null($this->getParam('refresh_token'))) { - $return['refresh_token'] = $this->getParam('refresh_token'); - } - - $return['id_token'] = $this->generateJWT(); - - return $return; - } - - /** - * Generate an JWT - * @return string - */ - public function generateJWT() - { - $now = new \DateTime(); - - $token = [ - 'iss' => self::$issuer, - 'aud' => self::$audience, - 'sub' => $this->accessToken->getOwnerIdentifier(), - 'exp' => $this->accessToken->getExpiryDateTime()->getTimestamp(), - 'nbf' => $now->getTimestamp(), - 'iat' => $now->getTimestamp(), - 'jti' => SecureKey::generate() - ]; - - return JWT::encode($token, self::$encryptionKey); - } - - /** - * @return \Symfony\Component\HttpFoundation\Response - */ - public function generateHttpResponse() - { - return new Response( - json_encode([ - $this->generateResponse() - ]), - 200, - [ - 'Content-type' => 'application/json', - 'Cache-Control' => 'no-store', - 'Pragma' => 'no-cache' - ] - ); - } - - /** - * Determine the access token in the authorization header - * - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return string - */ - public function determineAccessTokenInHeader(Request $request) - { - // TODO: Implement determineAccessTokenInHeader() method. - } -}