Skip to content

Commit 59bad40

Browse files
author
Steve Porter
committed
refactor: reformat code
1 parent b18c30f commit 59bad40

11 files changed

+319
-309
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.project
2+
*.sublime-project
3+
*.sublime-workspace
4+
.DS_Store
5+
.idea/
6+
composer.lock
7+
composer.phar
8+
phpunit.phar
9+
vendor

composer.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
{
2-
"name": "arietimmerman/laravel-oauth-introspect-middleware",
2+
"name": "designmynight/laravel-oauth-introspect-middleware",
33
"description": "Laravel Middleware for letting a resource owner verify a OAuth2 access tokens with a remote authorization server",
44
"type": "library",
55
"license": "MIT",
66
"authors": [
77
{
8-
"name": "Arie Timmerman",
9-
"email": "arietimmerman@gmail.com"
10-
}
8+
"name": "Steve Porter",
9+
"email": "steve@designmynight.com"
10+
},
1111
],
1212
"require": {
1313
"php": "^7.0",
1414
"guzzlehttp/guzzle": "~6.0",
1515
"laravel/framework": "^5.5"
1616
},
1717
"autoload": {
18-
"psr-4": {"ArieTimmerman\\Laravel\\OAuth2\\": "src/"}
18+
"psr-4": {"DesignMyNight\\Laravel\\OAuth2\\": "src/"}
1919
},
2020
"autoload-dev": {
2121
"psr-4": {
22-
"ArieTimmerman\\Laravel\\OAuth2\\Tests\\": "tests"
22+
"DesignMyNight\\Laravel\\OAuth2\\Tests\\": "tests"
2323
}
2424
},
2525
"require-dev": {
2626
"orchestra/testbench": "~3.0"
27+
},
28+
"extra": {
29+
"laravel": {
30+
"providers": [
31+
"DesignMyNight\\Laravel\\OAuth2\\IntrospectMiddlewareServiceProvider"
32+
]
33+
}
2734
}
2835
}

config/authorizationserver.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<?php
22

33
return [
4-
5-
'authorization_server_authorization_url' => env('AUTHORIZATION_SERVER_AUTHORIZATION_URL', false),
6-
'authorization_server_redirect_url' => env('AUTHORIZATION_SERVER_REDIRECT_URL', false),
7-
'authorization_server_token_url' => env('AUTHORIZATION_SERVER_TOKEN_URL', false),
8-
'authorization_server_introspect_url' => env('AUTHORIZATION_SERVER_INTROSPECT_URL', false),
9-
'authorization_server_client_id' => env('AUTHORIZATION_SERVER_CLIENT_ID', false),
10-
'authorization_server_client_secret' => env('AUTHORIZATION_SERVER_CLIENT_SECRET', false)
11-
4+
'authorization_url' => env('AUTHORIZATION_SERVER_AUTHORIZATION_URL'),
5+
'redirect_url' => env('AUTHORIZATION_SERVER_REDIRECT_URL'),
6+
'token_url' => env('AUTHORIZATION_SERVER_TOKEN_URL'),
7+
'introspect_url' => env('AUTHORIZATION_SERVER_INTROSPECT_URL'),
8+
'client_id' => env('AUTHORIZATION_SERVER_CLIENT_ID'),
9+
'client_secret' => env('AUTHORIZATION_SERVER_CLIENT_SECRET'),
1210
];
13-

routes/routes.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?php
22

33
/**
4-
* Redirectiong endpoint for initiating the OAuth2 Implicit Grant flow.
4+
* Redirecting endpoint for initiating the OAuth2 Implicit Grant flow.
55
* The retrieved access token can be used to call the APIs as protected with the provided middleware.
6-
*
6+
*
77
* Note: this module does not provide any logic for extracting the access tokens from the url.
8-
*
8+
*
99
*/
1010
Route::get('/redirect', function (Request $request) {
11-
$query = http_build_query([
12-
'client_id' => config('authorizationserver.authorization_server_client_id'),
13-
'redirect_uri' => config('authorizationserver.authorization_server_redirect_url'),
14-
'response_type' => 'token',
15-
'scope' => 'place-orders',
16-
]);
11+
$query = http_build_query([
12+
'client_id' => config('authorizationserver.client_id'),
13+
'redirect_uri' => config('authorizationserver.redirect_url'),
14+
'response_type' => 'token',
15+
'scope' => 'place-orders',
16+
]);
1717

18-
return redirect(config('authorizationserver.authorization_server_authorization_url') . '?' . $query);
18+
return redirect(config('authorizationserver.authorization_url') . '?' . $query);
1919
});
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
2+
namespace DesignMyNight\Laravel\OAuth2\Exceptions;
23

3-
namespace ArieTimmerman\Laravel\OAuth2\Exceptions;
4-
5-
class InvalidAccessTokenException extends \Exception{
6-
7-
}
4+
class InvalidAccessTokenException extends \Exception
5+
{
6+
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
2+
namespace DesignMyNight\Laravel\OAuth2\Exceptions;
23

3-
namespace ArieTimmerman\Laravel\OAuth2\Exceptions;
4-
5-
class InvalidEndpointException extends InvalidAccessTokenException{
6-
7-
}
4+
class InvalidEndpointException extends InvalidAccessTokenException
5+
{
6+
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
2+
namespace DesignMyNight\Laravel\OAuth2\Exceptions;
23

3-
namespace ArieTimmerman\Laravel\OAuth2\Exceptions;
4-
5-
class InvalidInputException extends InvalidAccessTokenException{
6-
7-
}
4+
class InvalidInputException extends InvalidAccessTokenException
5+
{
6+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
namespace DesignMyNight\Laravel\OAuth2;
3+
4+
use Illuminate\Foundation\Application as LaravelApplication;
5+
use Illuminate\Support\ServiceProvider;
6+
use Laravel\Lumen\Application as LumenApplication;
7+
8+
class IntrospectMiddlewareServiceProvider extends ServiceProvider
9+
{
10+
public function boot()
11+
{
12+
$source = realpath(__DIR__ . '/../config/authorizationserver.php');
13+
14+
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
15+
$this->publishes([$source => config_path('authorizationserver.php')]);
16+
} else if ($this->app instanceof LumenApplication) {
17+
$this->app->configure('authorizationserver');
18+
}
19+
20+
$routes = realpath(__DIR__ . '/../routes/routes.php');
21+
22+
$this->loadRoutesFrom($routes);
23+
$this->mergeConfigFrom($source, 'authorizationserver');
24+
}
25+
26+
/**
27+
* Register the service provider.
28+
*
29+
* @return void
30+
*/
31+
public function register()
32+
{
33+
}
34+
}

src/ServiceProvider.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)