Skip to content

Commit

Permalink
Merge branch 'release/2.2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
hswong3i committed Sep 6, 2014
2 parents 0e33f11 + 86a8917 commit def1368
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Controller/OAuth2Controller.php
Expand Up @@ -30,4 +30,9 @@ public function debugAction(Request $request)
{
return $this->get('authbucket_oauth2.oauth2_controller')->debugAction($request);
}

public function cronAction(Request $request)
{
return $this->get('authbucket_oauth2.oauth2_controller')->cronAction($request);
}
}
7 changes: 7 additions & 0 deletions Resources/config/routing.yml
Expand Up @@ -6,10 +6,17 @@ api_oauth2_authorize:
api_oauth2_token:
pattern: /api/v1.0/oauth2/token
defaults: { _controller: AuthBucketOAuth2Bundle:OAuth2:token }
methods: [ POST ]

api_oauth2_debug:
pattern: /api/v1.0/oauth2/debug
defaults: { _controller: AuthBucketOAuth2Bundle:OAuth2:debug }
methods: [ GET|POST ]

api_oauth2_cron:
pattern: /api/v1.0/oauth2/cron
defaults: { _controller: AuthBucketOAuth2Bundle:OAuth2:cron }
methods: [ GET ]

api_authorize_create:
pattern: /api/v1.0/authorize.{_format}
Expand Down
1 change: 1 addition & 0 deletions Resources/config/services.yml
Expand Up @@ -63,6 +63,7 @@ services:
arguments:
- "@security.context"
- "@validator"
- "@authbucket_oauth2.model_manager.factory"
- "@authbucket_oauth2.response_handler.factory"
- "@authbucket_oauth2.grant_handler.factory"

Expand Down
24 changes: 24 additions & 0 deletions Tests/Controller/OAuth2ControllerTest.php
Expand Up @@ -191,4 +191,28 @@ public function testGoodAccessToken()
$resourceResponse = json_decode($client->getResponse()->getContent(), true);
$this->assertEquals('demousername1', $resourceResponse['username']);
}

public function testCron()
{
$parameters = array();
$server = array(
'HTTP_Authorization' => implode(' ', array('Bearer', 'eeb5aa92bbb4b56373b9e0d00bc02d93')),
);
$client = $this->createClient();
$crawler = $client->request('GET', '/api/v1.0/oauth2/cron', $parameters, array(), $server);

$modelManagerFactory = $this->get('authbucket_oauth2.model_manager.factory');
$this->assertEmpty($modelManagerFactory->getModelManager('access_token')
->readModelBy(array(
'accessToken' => 'd2b58c4c6bc0cc9fefca2d558f1221a5',
)));
$this->assertEmpty($modelManagerFactory->getModelManager('code')
->readModelBy(array(
'code' => '1e5aa97ddaf4b0228dfb4223010d4417',
)));
$this->assertEmpty($modelManagerFactory->getModelManager('refresh_token')
->readModelBy(array(
'refreshToken' => '5ff43cbc27b54202c6fd8bb9c2a308ce',
)));
}
}

0 comments on commit def1368

Please sign in to comment.