@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | private static function verifyToken(string $jwt, string $uri, bool $jwk = false): object |
| 100 | 100 | { |
| 101 | 101 | $kid = self::getKid($jwt); |
| 102 | - if (! $kid) { |
|
| 102 | + if (!$kid) { |
|
| 103 | 103 | throw AuthException::auth(422, 'Malformed JWT'); |
| 104 | 104 | } |
| 105 | 105 | if (config('jwtauthroles.cache.enabled')) { |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | ? self::getJwk($kid, $uri) |
| 116 | 116 | : self::getPem($kid, $uri); |
| 117 | 117 | |
| 118 | - if (! isset($publicKey) || ! $publicKey) { |
|
| 118 | + if (!isset($publicKey) || !$publicKey) { |
|
| 119 | 119 | throw AuthException::auth(500, 'Unable to validate JWT'); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | ? config('jwtauthroles.jwkUri') |
| 138 | 138 | : config('jwtauthroles.pemUri'); |
| 139 | 139 | |
| 140 | - if (! config('jwtauthroles.validateJwt')) { |
|
| 140 | + if (!config('jwtauthroles.validateJwt')) { |
|
| 141 | 141 | $claims = self::getClaims($jwt); |
| 142 | 142 | } else { |
| 143 | 143 | $claims = self::verifyToken($jwt, $uri, config('jwtauthroles.useJwk')); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if(config('jwtauthroles.useDB')) { |
|
| 146 | + if (config('jwtauthroles.useDB')) { |
|
| 147 | 147 | if (config('jwtauthroles.autoCreateUser')) { |
| 148 | 148 | $user = JwtUser::firstOrNew([config('jwtauthroles.userId') => $claims->sub]); |
| 149 | 149 | $user[config('jwtauthroles.userId')] = $claims->sub; |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | if (function_exists('config_path')) { // function not available and 'publish' not relevant in Lumen |
| 24 | 24 | $this->publishes([ |
| 25 | - __DIR__ . '/../config/jwtauthroles.php' => config_path('jwtauthroles.php'), |
|
| 25 | + __DIR__.'/../config/jwtauthroles.php' => config_path('jwtauthroles.php'), |
|
| 26 | 26 | ], 'config'); |
| 27 | 27 | |
| 28 | 28 | $this->publishes([ |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function register() |
| 40 | 40 | { |
| 41 | - $this->mergeConfigFrom(__DIR__ . '/../config/jwtauthroles.php', 'jwtauthroles'); |
|
| 41 | + $this->mergeConfigFrom(__DIR__.'/../config/jwtauthroles.php', 'jwtauthroles'); |
|
| 42 | 42 | |
| 43 | 43 | // Register the service the package provides. |
| 44 | - $this->app->singleton('JwtAuthRoles', function ($app) { |
|
| 44 | + $this->app->singleton('JwtAuthRoles', function($app) { |
|
| 45 | 45 | return new JwtAuthRoles; |
| 46 | 46 | }); |
| 47 | 47 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | // Publishing the configuration file. |
| 67 | 67 | $this->publishes([ |
| 68 | - __DIR__ . '/../config/jwtauthroles.php' => config_path('jwtauthroles.php'), |
|
| 68 | + __DIR__.'/../config/jwtauthroles.php' => config_path('jwtauthroles.php'), |
|
| 69 | 69 | ], 'jwtauthroles.config'); |
| 70 | 70 | |
| 71 | 71 | // Publishing the views. |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $timestamp = date('Y_m_d_His'); |
| 99 | 99 | |
| 100 | 100 | return Collection::make($this->app->databasePath().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR) |
| 101 | - ->flatMap(function ($path) use ($filesystem) { |
|
| 101 | + ->flatMap(function($path) use ($filesystem) { |
|
| 102 | 102 | return $filesystem->glob($path.'*_create_jwtauth_tables.php'); |
| 103 | 103 | })->push($this->app->databasePath()."/migrations/{$timestamp}_create_jwtauth_tables.php") |
| 104 | 104 | ->first(); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | if (function_exists('config_path')) { // function not available and 'publish' not relevant in Lumen |
| 24 | 24 | $this->publishes([ |
| 25 | - __DIR__ . '/../config/jwtauthroles.php' => config_path('jwtauthroles.php'), |
|
| 25 | + __DIR__.'/../config/jwtauthroles.php' => config_path('jwtauthroles.php'), |
|
| 26 | 26 | ], 'config'); |
| 27 | 27 | |
| 28 | 28 | $this->publishes([ |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function register() |
| 40 | 40 | { |
| 41 | - $this->mergeConfigFrom(__DIR__ . '/../config/jwtauthroles.php', 'jwtauthroles'); |
|
| 41 | + $this->mergeConfigFrom(__DIR__.'/../config/jwtauthroles.php', 'jwtauthroles'); |
|
| 42 | 42 | |
| 43 | 43 | // Register the service the package provides. |
| 44 | - $this->app->singleton('JwtAuthRoles', function ($app) { |
|
| 44 | + $this->app->singleton('JwtAuthRoles', function($app) { |
|
| 45 | 45 | return new JwtAuthRoles; |
| 46 | 46 | }); |
| 47 | 47 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | // Publishing the configuration file. |
| 67 | 67 | $this->publishes([ |
| 68 | - __DIR__ . '/../config/jwtauthroles.php' => config_path('jwtauthroles.php'), |
|
| 68 | + __DIR__.'/../config/jwtauthroles.php' => config_path('jwtauthroles.php'), |
|
| 69 | 69 | ], 'jwtauthroles.config'); |
| 70 | 70 | |
| 71 | 71 | // Publishing the views. |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $timestamp = date('Y_m_d_His'); |
| 99 | 99 | |
| 100 | 100 | return Collection::make($this->app->databasePath().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR) |
| 101 | - ->flatMap(function ($path) use ($filesystem) { |
|
| 101 | + ->flatMap(function($path) use ($filesystem) { |
|
| 102 | 102 | return $filesystem->glob($path.'*_create_jwtauth_tables.php'); |
| 103 | 103 | })->push($this->app->databasePath()."/migrations/{$timestamp}_create_jwtauth_tables.php") |
| 104 | 104 | ->first(); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | private static function verifyToken(string $jwt, string $uri, bool $jwk = false): object |
| 100 | 100 | { |
| 101 | 101 | $kid = self::getKid($jwt); |
| 102 | - if (! $kid) { |
|
| 102 | + if (!$kid) { |
|
| 103 | 103 | throw AuthException::auth(422, 'Malformed JWT'); |
| 104 | 104 | } |
| 105 | 105 | if (config('jwtauthroles.cache.enabled')) { |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | ? self::getJwk($kid, $uri) |
| 116 | 116 | : self::getPem($kid, $uri); |
| 117 | 117 | |
| 118 | - if (! isset($publicKey) || ! $publicKey) { |
|
| 118 | + if (!isset($publicKey) || !$publicKey) { |
|
| 119 | 119 | throw AuthException::auth(500, 'Unable to validate JWT'); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | ? config('jwtauthroles.jwkUri') |
| 138 | 138 | : config('jwtauthroles.pemUri'); |
| 139 | 139 | |
| 140 | - if (! config('jwtauthroles.validateJwt')) { |
|
| 140 | + if (!config('jwtauthroles.validateJwt')) { |
|
| 141 | 141 | $claims = self::getClaims($jwt); |
| 142 | 142 | } else { |
| 143 | 143 | $claims = self::verifyToken($jwt, $uri, config('jwtauthroles.useJwk')); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if(config('jwtauthroles.useDB')) { |
|
| 146 | + if (config('jwtauthroles.useDB')) { |
|
| 147 | 147 | if (config('jwtauthroles.autoCreateUser')) { |
| 148 | 148 | $user = JwtUser::firstOrNew([config('jwtauthroles.userId') => $claims->sub]); |
| 149 | 149 | $user[config('jwtauthroles.userId')] = $claims->sub; |