@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | protected $tag; |
19 | 19 | |
20 | 20 | /** |
21 | - * @param \Illuminate\Cache\CacheManager $cache |
|
21 | + * @param Repository $cache |
|
22 | 22 | * @param string $tag |
23 | 23 | */ |
24 | 24 | public function __construct(Repository $cache, $tag = 'jwt') |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * Add a new item into storage. |
32 | 32 | * |
33 | 33 | * @param string $key |
34 | - * @param mixed $value |
|
34 | + * @param string $value |
|
35 | 35 | * @param int $minutes |
36 | 36 | * @return void |
37 | 37 | */ |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @param string $key |
45 | - * @param mixed $value |
|
45 | + * @param string $value |
|
46 | 46 | * @return void |
47 | 47 | */ |
48 | 48 | public function forever($key, $value) |
@@ -89,7 +89,7 @@ |
||
89 | 89 | */ |
90 | 90 | protected function cache() |
91 | 91 | { |
92 | - if (! method_exists($this->cache, 'tags')) { |
|
92 | + if (!method_exists($this->cache, 'tags')) { |
|
93 | 93 | return $this->cache; |
94 | 94 | } |
95 | 95 |
@@ -163,6 +163,10 @@ |
||
163 | 163 | $this->assertEquals(500, $property->getValue($list)); |
164 | 164 | } |
165 | 165 | |
166 | + /** |
|
167 | + * @param string $id |
|
168 | + * @param integer $exp |
|
169 | + */ |
|
166 | 170 | protected function tokenStub($id = null, $exp = null, $claims = []) |
167 | 171 | { |
168 | 172 | $builder = new \Lcobucci\JWT\Builder(); |
@@ -9,6 +9,10 @@ |
||
9 | 9 | } |
10 | 10 | |
11 | 11 | if (!function_exists('config_path')) { |
12 | + |
|
13 | + /** |
|
14 | + * @param string $path |
|
15 | + */ |
|
12 | 16 | function config_path($path) { |
13 | 17 | return $path; |
14 | 18 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $auth = m::mock(\Illuminate\Auth\AuthManager::class); |
41 | 41 | $auth->shouldReceive('extend')->once(); |
42 | 42 | |
43 | - $app->singleton(\Illuminate\Auth\AuthManager::class, function () use ($auth) { |
|
43 | + $app->singleton(\Illuminate\Auth\AuthManager::class, function() use ($auth) { |
|
44 | 44 | return $auth; |
45 | 45 | }); |
46 | 46 |
@@ -37,6 +37,9 @@ |
||
37 | 37 | { |
38 | 38 | use \Framgia\Jwt\SigningTokens; |
39 | 39 | |
40 | + /** |
|
41 | + * @param string $type |
|
42 | + */ |
|
40 | 43 | public function signer($algorithm = 'sha256', $type = null) |
41 | 44 | { |
42 | 45 | // Pass call to protected method |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // If we've already retrieved the user for the current request we can just |
67 | 67 | // return it back immediately. We do not want to fetch the user data on |
68 | 68 | // every call to this method because that would be tremendously slow. |
69 | - if (! is_null($this->user)) { |
|
69 | + if (!is_null($this->user)) { |
|
70 | 70 | return $this->user; |
71 | 71 | } |
72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | $token = $this->getTokenForRequest(); |
76 | 76 | |
77 | - if (! is_null($token)) { |
|
77 | + if (!is_null($token)) { |
|
78 | 78 | $user = $this->provider->retrieveById($token->getClaim('sub')); |
79 | 79 | } |
80 | 80 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $builder->setSubject($id); |
141 | 141 | |
142 | 142 | if ($this->user instanceof ProvidesCredentials) { |
143 | - foreach($this->user->getCredentials() as $key => $value) { |
|
143 | + foreach ($this->user->getCredentials() as $key => $value) { |
|
144 | 144 | $builder->set($key, $value); |
145 | 145 | } |
146 | 146 | } |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | public function boot() |
17 | 17 | { |
18 | 18 | $this->publishes([ |
19 | - __DIR__ . '/../config/jwt.php' => config_path('api.php') |
|
19 | + __DIR__.'/../config/jwt.php' => config_path('api.php') |
|
20 | 20 | ]); |
21 | 21 | |
22 | - $this->mergeConfigFrom(__DIR__ . '/../config/jwt.php', 'jwt'); |
|
22 | + $this->mergeConfigFrom(__DIR__.'/../config/jwt.php', 'jwt'); |
|
23 | 23 | |
24 | 24 | $manager = $this->app[AuthManager::class]; |
25 | 25 | |
26 | - $manager->extend('jwt', function ($app, $name, $config) use ($manager) { |
|
26 | + $manager->extend('jwt', function($app, $name, $config) use ($manager) { |
|
27 | 27 | $guard = new Guard($manager->provider($config['provider']), $app[Request::class], $app[Blacklist::class], $app[SignerContract::class]); |
28 | 28 | |
29 | 29 | $app->refresh(Request::class, $guard, 'setRequest'); |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function register() |
41 | 41 | { |
42 | - $this->app->singleton(CacheStorage::class, function ($app) { |
|
42 | + $this->app->singleton(CacheStorage::class, function($app) { |
|
43 | 43 | return new CacheStorage($app[Cache::class]); |
44 | 44 | }); |
45 | 45 | |
46 | - $this->app->singleton(Blacklist::class, function ($app) { |
|
46 | + $this->app->singleton(Blacklist::class, function($app) { |
|
47 | 47 | return new Blacklist($app[StorageContract::class]); |
48 | 48 | }); |
49 | 49 | |
50 | - $this->app->singleton(SignerFactory::class, function ($app) { |
|
50 | + $this->app->singleton(SignerFactory::class, function($app) { |
|
51 | 51 | return new SignerFactory($app); |
52 | 52 | }); |
53 | 53 | |
54 | - $this->app->bind(SignerContract::class, function ($app) { |
|
54 | + $this->app->bind(SignerContract::class, function($app) { |
|
55 | 55 | return $app[SignerFactory::class]->driver(); |
56 | 56 | }); |
57 | 57 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | // if there is no exp claim then add the jwt to |
57 | 57 | // the blacklist indefinitely |
58 | - if (! $token->hasClaim('exp')) { |
|
58 | + if (!$token->hasClaim('exp')) { |
|
59 | 59 | return $this->addForever($token); |
60 | 60 | } |
61 | 61 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | // check whether the expiry + grace has past |
117 | - return $val !== null && ! Carbon::createFromTimestamp($val['valid_until'])->isFuture(); |
|
117 | + return $val !== null && !Carbon::createFromTimestamp($val['valid_until'])->isFuture(); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |