Skip to content

Commit

Permalink
Merge branch 'hotfix/2.1.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
hswong3i committed Aug 20, 2014
2 parents ec18511 + 40bb7c8 commit b5b6b9e
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 35 deletions.
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -191,7 +191,6 @@ endpoint:
'resource_type' => 'debug_endpoint',
'scope' => array('demoscope1'),
'options' => array(
'token_path' => 'http://example.com/oauth2/token',
'debug_path' => 'http://example.com/oauth2/debug',
'cache' => true,
),
Expand Down
3 changes: 0 additions & 3 deletions app/config/security.php
Expand Up @@ -71,7 +71,6 @@
'resource_type' => 'debug_endpoint',
'scope' => array('demoscope1'),
'options' => array(
'token_path' => '/oauth2/token',
'debug_path' => '/oauth2/debug',
'cache' => false,
),
Expand All @@ -83,7 +82,6 @@
'resource_type' => 'debug_endpoint',
'scope' => array('demoscope1'),
'options' => array(
'token_path' => '/oauth2/token',
'debug_path' => '/oauth2/debug',
'cache' => true,
),
Expand All @@ -95,7 +93,6 @@
'resource_type' => 'debug_endpoint',
'scope' => array('demoscope1'),
'options' => array(
'token_path' => '',
'debug_path' => '',
'cache' => true,
),
Expand Down
Expand Up @@ -30,15 +30,12 @@ public function handle(
)
{
$options = array_merge(array(
'token_path' => '/oauth2/token',
'debug_path' => '/oauth2/debug',
'cache' => true,
), $options);

// Both options are required.
if (!$options['token_path']
|| !$options['debug_path']
) {
if (!$options['debug_path']) {
throw new ServerErrorException(array(
'error_description' => 'The authorization server encountered an unexpected condition that prevented it from fulfilling the request.',
));
Expand Down
1 change: 0 additions & 1 deletion tests/src/AuthBucket/OAuth2/Tests/Model/InMemoryTest.php
Expand Up @@ -43,7 +43,6 @@ public function createApplication()
->setUsername('demousername1')
->setExpires(new \DateTime('+1 hours'))
->setScope(array(
'debug',
'demoscope1',
));
$accessTokenManager->createModel($model);
Expand Down
22 changes: 11 additions & 11 deletions tests/src/AuthBucket/OAuth2/Tests/OAuth2Test.php
Expand Up @@ -34,7 +34,7 @@ public function testAuthorizationCodeGrant()
'response_type' => 'code',
'client_id' => 'http://democlient1.com/',
'redirect_uri' => 'http://democlient1.com/redirect_uri',
'scope' => 'debug demoscope1',
'scope' => 'demoscope1',
'state' => $session->getId(),
);
$server = array(
Expand Down Expand Up @@ -72,7 +72,7 @@ public function testAuthorizationCodeGrant()
$parameters = array(
'grant_type' => 'refresh_token',
'refresh_token' => $tokenResponse['refresh_token'],
'scope' => 'debug demoscope1',
'scope' => 'demoscope1',
);
$server = array(
'PHP_AUTH_USER' => 'http://democlient1.com/',
Expand All @@ -84,7 +84,7 @@ public function testAuthorizationCodeGrant()
// Check basic token response that can simply compare.
$tokenResponse = json_decode($client->getResponse()->getContent(), true);
$this->assertEquals('bearer', $tokenResponse['token_type']);
$this->assertEquals('debug demoscope1', $tokenResponse['scope']);
$this->assertEquals('demoscope1', $tokenResponse['scope']);

// Query debug endpoint with access_token.
$parameters = array();
Expand All @@ -108,7 +108,7 @@ public function testImplicitGrant()
'response_type' => 'token',
'client_id' => 'http://democlient1.com/',
'redirect_uri' => 'http://democlient1.com/redirect_uri',
'scope' => 'debug demoscope1',
'scope' => 'demoscope1',
'state' => $session->getId(),
);
$server = array(
Expand All @@ -129,7 +129,7 @@ public function testImplicitGrant()
// Check basic token response that can simply compare.
$tokenResponse = $authResponse->query->all();
$this->assertEquals('bearer', $tokenResponse['token_type']);
$this->assertEquals('debug demoscope1', $tokenResponse['scope']);
$this->assertEquals('demoscope1', $tokenResponse['scope']);
$this->assertEquals($session->getId(), $tokenResponse['state']);

// Query debug endpoint with access_token.
Expand All @@ -150,7 +150,7 @@ public function testResourceOwnerPasswordCredentialsGrant()
'grant_type' => 'password',
'username' => 'demousername1',
'password' => 'demopassword1',
'scope' => 'debug demoscope1',
'scope' => 'demoscope1',
);
$server = array(
'PHP_AUTH_USER' => 'http://democlient1.com/',
Expand All @@ -165,7 +165,7 @@ public function testResourceOwnerPasswordCredentialsGrant()
$parameters = array(
'grant_type' => 'refresh_token',
'refresh_token' => $tokenResponse['refresh_token'],
'scope' => 'debug demoscope1',
'scope' => 'demoscope1',
);
$server = array(
'PHP_AUTH_USER' => 'http://democlient1.com/',
Expand All @@ -177,7 +177,7 @@ public function testResourceOwnerPasswordCredentialsGrant()
// Check basic token response that can simply compare.
$tokenResponse = json_decode($client->getResponse()->getContent(), true);
$this->assertEquals('bearer', $tokenResponse['token_type']);
$this->assertEquals('debug demoscope1', $tokenResponse['scope']);
$this->assertEquals('demoscope1', $tokenResponse['scope']);

// Query debug endpoint with access_token.
$parameters = array();
Expand All @@ -195,7 +195,7 @@ public function testClientCredentialsGrant()
// Query the token endpoint with grant_type = client_credentials.
$parameters = array(
'grant_type' => 'client_credentials',
'scope' => 'debug demoscope1 demoscope2 demoscope3',
'scope' => 'demoscope1 demoscope2 demoscope3',
);
$server = array(
'PHP_AUTH_USER' => 'http://democlient1.com/',
Expand All @@ -210,7 +210,7 @@ public function testClientCredentialsGrant()
$parameters = array(
'grant_type' => 'refresh_token',
'refresh_token' => $tokenResponse['refresh_token'],
'scope' => 'debug demoscope1 demoscope2 demoscope3',
'scope' => 'demoscope1 demoscope2 demoscope3',
);
$server = array(
'PHP_AUTH_USER' => 'http://democlient1.com/',
Expand All @@ -222,7 +222,7 @@ public function testClientCredentialsGrant()
// Check basic token response that can simply compare.
$tokenResponse = json_decode($client->getResponse()->getContent(), true);
$this->assertEquals('bearer', $tokenResponse['token_type']);
$this->assertEquals('debug demoscope1 demoscope2 demoscope3', $tokenResponse['scope']);
$this->assertEquals('demoscope1 demoscope2 demoscope3', $tokenResponse['scope']);

// Query debug endpoint with access_token.
$parameters = array();
Expand Down
Expand Up @@ -26,7 +26,6 @@ public function load(ObjectManager $manager)
->setUsername('demousername1')
->setExpires(new \DateTime('+1 hours'))
->setScope(array(
'debug',
'demoscope1',
));
$manager->persist($model);
Expand Down
Expand Up @@ -23,7 +23,6 @@ public function load(ObjectManager $manager)
$model->setClientId('51b2d34c3a661b5e111a694dfcb4b248')
->setUsername('demousername1')
->setScope(array(
'debug',
'demoscope1',
'demoscope2',
'demoscope3',
Expand All @@ -34,7 +33,6 @@ public function load(ObjectManager $manager)
$model->setClientId('authorization_code_grant')
->setUsername('demousername1')
->setScope(array(
'debug',
'demoscope1',
));
$manager->persist($model);
Expand All @@ -43,7 +41,6 @@ public function load(ObjectManager $manager)
$model->setClientId('implicit_grant')
->setUsername('demousername1')
->setScope(array(
'debug',
'demoscope1',
));
$manager->persist($model);
Expand All @@ -52,7 +49,6 @@ public function load(ObjectManager $manager)
$model->setClientId('resource_owner_password_credentials_grant')
->setUsername('demousername1')
->setScope(array(
'debug',
'demoscope1',
));
$manager->persist($model);
Expand All @@ -61,7 +57,6 @@ public function load(ObjectManager $manager)
$model->setClientId('client_credentials_grant')
->setUsername('')
->setScope(array(
'debug',
'demoscope1',
));
$manager->persist($model);
Expand All @@ -70,7 +65,6 @@ public function load(ObjectManager $manager)
$model->setClientId('http://democlient1.com/')
->setUsername('demousername1')
->setScope(array(
'debug',
'demoscope1',
));
$manager->persist($model);
Expand All @@ -79,7 +73,6 @@ public function load(ObjectManager $manager)
$model->setClientId('http://democlient2.com/')
->setUsername('demousername2')
->setScope(array(
'debug',
'demoscope1',
'demoscope2',
));
Expand All @@ -89,7 +82,6 @@ public function load(ObjectManager $manager)
$model->setClientId('http://democlient3.com/')
->setUsername('demousername3')
->setScope(array(
'debug',
'demoscope1',
'demoscope2',
'demoscope3',
Expand All @@ -100,7 +92,6 @@ public function load(ObjectManager $manager)
$model->setClientId('http://democlient1.com/')
->setUsername('')
->setScope(array(
'debug',
'demoscope1',
'demoscope2',
'demoscope3',
Expand Down
Expand Up @@ -19,10 +19,6 @@ class ScopeFixture implements FixtureInterface
{
public function load(ObjectManager $manager)
{
$model = new Scope();
$model->setScope('debug');
$manager->persist($model);

$model = new Scope();
$model->setScope('demoscope1');
$manager->persist($model);
Expand Down
Expand Up @@ -126,7 +126,6 @@ $app['security.firewalls'] = array(
'resource_type' => 'debug_endpoint',
'scope' => array('demoscope1'),
'options' => array(
'token_path' => 'http://example.com/oauth2/token',
'debug_path' => 'http://example.com/oauth2/debug',
'cache' => true,
),
Expand Down

0 comments on commit b5b6b9e

Please sign in to comment.