@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | | 'Auth0\Login\Auth0Controller@callback' |
38 | 38 | | |
39 | 39 | */ |
40 | - 'redirect_uri' => env('APP_URL') . '/auth0/callback', |
|
40 | + 'redirect_uri' => env('APP_URL').'/auth0/callback', |
|
41 | 41 | |
42 | 42 | /* |
43 | 43 | |-------------------------------------------------------------------------- |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | | This is used to verify the decoded tokens when using RS256 |
60 | 60 | | |
61 | 61 | */ |
62 | - 'authorized_issuers' => [env('AUTH0_DOMAIN')], |
|
62 | + 'authorized_issuers' => [ env('AUTH0_DOMAIN') ], |
|
63 | 63 | |
64 | 64 | /* |
65 | 65 | |-------------------------------------------------------------------------- |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | | Token decoding algorithms supported by your API |
86 | 86 | | |
87 | 87 | */ |
88 | - 'supported_algs' => ['RS256'], |
|
88 | + 'supported_algs' => [ 'RS256' ], |
|
89 | 89 | |
90 | 90 | /* |
91 | 91 | |-------------------------------------------------------------------------- |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | use Modules\User\Entities\User; |
4 | 4 | |
5 | -$factory->define(User::class, function (Faker\Generator $faker) { |
|
5 | +$factory->define(User::class, function(Faker\Generator $faker) { |
|
6 | 6 | return [ |
7 | 7 | 'provider' => 'database', |
8 | 8 | 'identity_id' => (new \MongoDB\BSON\ObjectId())->__toString(), |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | private function validateRequiredAttributes(\stdClass $profile) |
26 | 26 | { |
27 | - return array_keys_exists($this->requiredAttributes, (array)$profile); |
|
27 | + return array_keys_exists($this->requiredAttributes, (array) $profile); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $profile = $this->transformer->transformProfile($this->profile); |
116 | 116 | |
117 | 117 | if ($this->profileHasChanged()) { |
118 | - $profile['provider'] = $this->identityProvider; |
|
118 | + $profile[ 'provider' ] = $this->identityProvider; |
|
119 | 119 | $this->user->fill($profile); |
120 | 120 | $this->user->save(); |
121 | 121 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | protected function profileHasChanged(): bool |
127 | 127 | { |
128 | 128 | $user = $this->user->toArray(); |
129 | - $profile = (array)$this->profile; |
|
129 | + $profile = (array) $this->profile; |
|
130 | 130 | |
131 | 131 | return !array_is_subset_of($profile, $user); |
132 | 132 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public function getUserByUserInfo($userInfo) |
45 | 45 | { |
46 | - return $this->upsertUser($userInfo['profile']); |
|
46 | + return $this->upsertUser($userInfo[ 'profile' ]); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | protected function upsertUser($profile) |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | throw new BadRequestHttpException('Missing token information: Auth0 user id is not set'); |
53 | 53 | } |
54 | 54 | $identifier = explode('|', $profile->user_id); |
55 | - $identityProvider = $identifier[0]; |
|
56 | - $id = $identifier[1]; |
|
55 | + $identityProvider = $identifier[ 0 ]; |
|
56 | + $id = $identifier[ 1 ]; |
|
57 | 57 | |
58 | 58 | $user = $this->service->find($id); |
59 | 59 |
@@ -38,14 +38,14 @@ |
||
38 | 38 | $user = $this->auth0Service->getUserByDecodedJWT($tokenInfo); |
39 | 39 | |
40 | 40 | if (!$user) { |
41 | - return response()->json(['error' => 'Unauthorized user.'], 401); |
|
41 | + return response()->json([ 'error' => 'Unauthorized user.' ], 401); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | \Auth::login($user); |
45 | 45 | } catch (InvalidTokenException $e) { |
46 | - return response()->json(['error' => 'Invalid or no token set.'], 401); |
|
46 | + return response()->json([ 'error' => 'Invalid or no token set.' ], 401); |
|
47 | 47 | } catch (CoreException $e) { |
48 | - return response()->json(['error' => $e->getMessage()], 401); |
|
48 | + return response()->json([ 'error' => $e->getMessage() ], 401); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $next($request); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function boot() |
33 | 33 | { |
34 | - $this->app->bind(\Auth0\Login\Contract\Auth0UserRepository::class, function (){ |
|
34 | + $this->app->bind(\Auth0\Login\Contract\Auth0UserRepository::class, function() { |
|
35 | 35 | return new Auth0Service(new UserService()); |
36 | 36 | }); |
37 | 37 | } |
@@ -11,6 +11,6 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Broadcast::channel('user.{id}', function ($user, $id) { |
|
15 | - return $user->identity_id === $id; |
|
14 | +Broadcast::channel('user.{id}', function($user, $id) { |
|
15 | + return $user->identity_id === $id; |
|
16 | 16 | }); |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | |
45 | 45 | private function getUserTokenData(): \stdClass |
46 | 46 | { |
47 | - return Cache::remember('testing:http_access_token', 60, function () { |
|
47 | + return Cache::remember('testing:http_access_token', 60, function() { |
|
48 | 48 | try { |
49 | 49 | $httpClient = new Client(); |
50 | - $response = $httpClient->post(config('laravel-auth0.domain') . 'oauth/token', [ |
|
50 | + $response = $httpClient->post(config('laravel-auth0.domain').'oauth/token', [ |
|
51 | 51 | 'form_params' => [ |
52 | 52 | 'grant_type' => 'password', |
53 | 53 | 'client_id' => env('AUTH0_CLIENT_ID'), |
@@ -64,22 +64,22 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | protected function decodeHttpContent($content) { |
67 | - return json_decode($content,true)['data']; |
|
67 | + return json_decode($content, true)[ 'data' ]; |
|
68 | 68 | } |
69 | 69 | |
70 | - protected function http(string $method, string $route, array $payload = []) |
|
70 | + protected function http(string $method, string $route, array $payload = [ ]) |
|
71 | 71 | { |
72 | 72 | return $this->sendRequest($method, $route, $payload, true); |
73 | 73 | } |
74 | 74 | |
75 | - private function sendRequest(string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
75 | + private function sendRequest(string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
76 | 76 | { |
77 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
78 | - 'Authorization' => 'Bearer ' . $this->getUserTokenData()->id_token, |
|
79 | - ] : []); |
|
77 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
78 | + 'Authorization' => 'Bearer '.$this->getUserTokenData()->id_token, |
|
79 | + ] : [ ]); |
|
80 | 80 | } |
81 | 81 | |
82 | - protected function httpNoAuth(string $method, string $route, array $payload = []) |
|
82 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ]) |
|
83 | 83 | { |
84 | 84 | return $this->sendRequest($method, $route, $payload, false); |
85 | 85 | } |