This commit is contained in:
Graham Campbell
2014-11-08 18:26:12 +00:00
parent 30162c8899
commit 4c1cd04a24
61 changed files with 430 additions and 503 deletions

View File

@@ -12,8 +12,8 @@
namespace League\OAuth2\Server\Grant;
use League\OAuth2\Server\AuthorizationServer;
use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\Exception;
/**
@@ -108,7 +108,7 @@ abstract class AbstractGrant implements GrantTypeInterface
/**
* Inject the authorization server into the grant
* @param \League\OAuth2\Server\AuthorizationServer $server The authorization server instance
* @param \League\OAuth2\Server\AuthorizationServer $server The authorization server instance
* @return self
*/
public function setAuthorizationServer(AuthorizationServer $server)
@@ -120,11 +120,11 @@ abstract class AbstractGrant implements GrantTypeInterface
/**
* Given a list of scopes, validate them and return an array of Scope entities
* @param string $scopeParam A string of scopes (e.g. "profile email birthday")
* @param \League\OAuth2\Server\Entity\ClientEntity $client Client entity
* @param string|null $redirectUri The redirect URI to return the user to
* @param string $scopeParam A string of scopes (e.g. "profile email birthday")
* @param \League\OAuth2\Server\Entity\ClientEntity $client Client entity
* @param string|null $redirectUri The redirect URI to return the user to
* @return \League\OAuth2\Server\Entity\ScopeEntity[]
* @throws \League\OAuth2\Server\Exception\InvalidScopeException If scope is invalid, or no scopes passed when required
* @throws \League\OAuth2\Server\Exception\InvalidScopeException If scope is invalid, or no scopes passed when required
*/
public function validateScopes($scopeParam = '', ClientEntity $client, $redirectUri = null)
{

View File

@@ -11,15 +11,15 @@
namespace League\OAuth2\Server\Grant;
use League\OAuth2\Server\Request;
use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\AuthCodeEntity;
use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\RefreshTokenEntity;
use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\AuthCodeEntity;
use League\OAuth2\Server\Util\SecureKey;
use League\OAuth2\Server\Event;
use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Request;
use League\OAuth2\Server\Util\SecureKey;
/**
* Auth code grant class
@@ -234,7 +234,7 @@ class AuthCodeGrant extends AbstractGrant
}
foreach ($session->getScopes() as $scope) {
$accessToken->associateScope($scope);
$accessToken->associateScope($scope);
}
$this->server->getTokenType()->setSession($session);

View File

@@ -14,9 +14,9 @@ namespace League\OAuth2\Server\Grant;
use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Event;
use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Util\SecureKey;
use League\OAuth2\Server\Event;
/**
* Client credentials grant class
@@ -53,7 +53,7 @@ class ClientCredentialsGrant extends AbstractGrant
*/
public function completeFlow()
{
// Get the required params
// Get the required params
$clientId = $this->server->getRequest()->request->get('client_id', null);
if (is_null($clientId)) {
$clientId = $this->server->getRequest()->getUser();
@@ -99,11 +99,11 @@ class ClientCredentialsGrant extends AbstractGrant
// Associate scopes with the session and access token
foreach ($scopes as $scope) {
$session->associateScope($scope);
$session->associateScope($scope);
}
foreach ($session->getScopes() as $scope) {
$accessToken->associateScope($scope);
$accessToken->associateScope($scope);
}
// Save everything

View File

@@ -11,13 +11,13 @@
namespace League\OAuth2\Server\Grant;
use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\RefreshTokenEntity;
use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Event;
use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Util\SecureKey;
use League\OAuth2\Server\Event;
/**
* Password grant class
@@ -141,11 +141,11 @@ class PasswordGrant extends AbstractGrant
// Associate scopes with the session and access token
foreach ($scopes as $scope) {
$session->associateScope($scope);
$session->associateScope($scope);
}
foreach ($session->getScopes() as $scope) {
$accessToken->associateScope($scope);
$accessToken->associateScope($scope);
}
$this->server->getTokenType()->setSession($session);

View File

@@ -11,13 +11,13 @@
namespace League\OAuth2\Server\Grant;
use League\OAuth2\Server\Request;
use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Util\SecureKey;
use League\OAuth2\Server\Entity\RefreshTokenEntity;
use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\RefreshTokenEntity;
use League\OAuth2\Server\Event;
use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Request;
use League\OAuth2\Server\Util\SecureKey;
/**
* Referesh token grant