Skip to content

Commit

Permalink
Merge pull request #4 from lucca-cardial/master
Browse files Browse the repository at this point in the history
Fix OAuth routes to Lumen 5.7
  • Loading branch information
kayrules authored Jan 12, 2019
2 parents 86b2b81 + 98c7988 commit 4734b56
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/PassportServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@ public function registerRoutes()
*/
public function forAccessTokens()
{
$this->app->group(['prefix' => config('api.prefix')], function () {
$this->app->post('/oauth/token', [
$this->app->router->group(['prefix' => config('api.prefix')], function () {
$this->app->router->post('/oauth/token', [
'uses' => '\Kayrules\LumenPassport\Http\Controllers\AccessTokenController@issueToken'
]);
});

$this->app->group(['prefix' => config('api.prefix'), 'middleware' => ['auth']], function () {
$this->app->get('/oauth/tokens', [
$this->app->router->group(['prefix' => config('api.prefix'), 'middleware' => ['auth']], function () {
$this->app->router->get('/oauth/tokens', [
'uses' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers\AuthorizedAccessTokenController@forUser',
]);

$this->app->delete('/oauth/tokens/{token_id}', [
$this->app->router->delete('/oauth/tokens/{token_id}', [
'uses' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers\AuthorizedAccessTokenController@destroy',
]);
});
Expand All @@ -86,8 +86,8 @@ public function forAccessTokens()
*/
public function forTransientTokens()
{
$this->app->group(['prefix' => config('api.prefix')], function () {
$this->app->post('/oauth/token/refresh', [
$this->app->router->group(['prefix' => config('api.prefix')], function () {
$this->app->router->post('/oauth/token/refresh', [
'middleware' => ['auth'],
'uses' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers\TransientTokenController@refresh',
]);
Expand All @@ -101,20 +101,20 @@ public function forTransientTokens()
*/
public function forClients()
{
$this->app->group(['prefix' => config('api.prefix'), 'middleware' => ['auth']], function () {
$this->app->get('/oauth/clients', [
$this->app->router->group(['prefix' => config('api.prefix'), 'middleware' => ['auth']], function () {
$this->app->router->get('/oauth/clients', [
'uses' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers\ClientController@forUser',
]);

$this->app->post('/oauth/clients', [
$this->app->router->post('/oauth/clients', [
'uses' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers\ClientController@store',
]);

$this->app->put('/oauth/clients/{client_id}', [
$this->app->router->put('/oauth/clients/{client_id}', [
'uses' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers\ClientController@update',
]);

$this->app->delete('/oauth/clients/{client_id}', [
$this->app->router->delete('/oauth/clients/{client_id}', [
'uses' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers\ClientController@destroy',
]);
});
Expand All @@ -127,20 +127,20 @@ public function forClients()
*/
public function forPersonalAccessTokens()
{
$this->app->group(['prefix' => config('api.prefix'), 'middleware' => ['auth']], function () {
$this->app->get('/oauth/scopes', [
$this->app->router->group(['prefix' => config('api.prefix'), 'middleware' => ['auth']], function () {
$this->app->router->get('/oauth/scopes', [
'uses' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers\ScopeController@all',
]);

$this->app->get('/oauth/personal-access-tokens', [
$this->app->router->get('/oauth/personal-access-tokens', [
'uses' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers\PersonalAccessTokenController@forUser',
]);

$this->app->post('/oauth/personal-access-tokens', [
$this->app->router->post('/oauth/personal-access-tokens', [
'uses' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers\PersonalAccessTokenController@store',
]);

$this->app->delete('/oauth/personal-access-tokens/{token_id}', [
$this->app->router->delete('/oauth/personal-access-tokens/{token_id}', [
'uses' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers\PersonalAccessTokenController@destroy',
]);
});
Expand Down

0 comments on commit 4734b56

Please sign in to comment.