From 22794d49d19b5bf3c533d10fffab0604f8e94a50 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sun, 9 Mar 2014 19:35:53 +0000 Subject: [PATCH] Removed old implicit grant --- src/League/OAuth2/Server/Grant/Implicit.php | 90 --------------------- 1 file changed, 90 deletions(-) delete mode 100644 src/League/OAuth2/Server/Grant/Implicit.php diff --git a/src/League/OAuth2/Server/Grant/Implicit.php b/src/League/OAuth2/Server/Grant/Implicit.php deleted file mode 100644 index 33eb3491..00000000 --- a/src/League/OAuth2/Server/Grant/Implicit.php +++ /dev/null @@ -1,90 +0,0 @@ - - * @copyright Copyright (c) PHP League of Extraordinary Packages - * @license http://mit-license.org/ - * @link http://github.com/php-loep/oauth2-server - */ - -namespace League\OAuth2\Server\Grant; - -use League\OAuth2\Server\Request; -use League\OAuth2\Server\Authorization; -use League\OAuth2\Server\Exception; -use League\OAuth2\Server\Util\SecureKey; -use League\OAuth2\Server\Storage\SessionInterface; -use League\OAuth2\Server\Storage\ClientInterface; -use League\OAuth2\Server\Storage\ScopeInterface; - -/** - * Client credentials grant class - */ -class Implicit implements GrantTypeInterface { - - use GrantTrait; - - /** - * Grant identifier - * @var string - */ - protected $identifier = 'implicit'; - - /** - * Response type - * @var string - */ - protected $responseType = 'token'; - - /** - * AuthServer instance - * @var AuthServer - */ - protected $authServer = null; - - /** - * Access token expires in override - * @var int - */ - protected $accessTokenTTL = null; - - /** - * Complete the client credentials grant - * @return array - */ - public function completeFlow() - { - // Remove any old sessions the user might have - $this->authServer->getStorage('session')->deleteSession($authParams['client_id'], 'user', $authParams['user_id']); - - // Generate a new access token - $accessToken = SecureKey::make(); - - // Compute expiry time - $accessTokenExpiresIn = ($this->accessTokenTTL !== null) ? $this->accessTokenTTL : $this->authServer->getAccessTokenTTL(); - $accessTokenExpires = time() + $accessTokenExpiresIn; - - // Create a new session - $sessionId = $this->authServer->getStorage('session')->createSession($authParams['client_id'], 'user', $authParams['user_id']); - - // Create an access token - $accessTokenId = $this->authServer->getStorage('session')->associateAccessToken($sessionId, $accessToken, $accessTokenExpires); - - // Associate scopes with the access token - foreach ($authParams['scopes'] as $scope) { - $this->authServer->getStorage('session')->associateScope($accessTokenId, $scope['id']); - } - - $response = array( - 'access_token' => $accessToken, - 'token_type' => 'Bearer', - 'expires' => $accessTokenExpires, - 'expires_in' => $accessTokenExpiresIn, - ); - - return $response; - } - -}