@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | Route::middleware([config('azure-oath.routes.middleware')])->group(function() { |
4 | - Route::get(config('azure-oath.routes.login' ), 'Metrogistics\AzureSocialite\WebAuthController@redirectToOauthProvider'); |
|
4 | + Route::get(config('azure-oath.routes.login'), 'Metrogistics\AzureSocialite\WebAuthController@redirectToOauthProvider'); |
|
5 | 5 | Route::get(config('azure-oath.routes.callback'), 'Metrogistics\AzureSocialite\WebAuthController@handleOauthResponse'); |
6 | 6 | |
7 | 7 | // This handles a situation where a route with the NAME of login does not exist, we define it to keep from breaking framework redirects hard coded |
8 | - if (! \Route::has('login') ) { |
|
8 | + if (!\Route::has('login')) { |
|
9 | 9 | Route::get('login', 'Metrogistics\AzureSocialite\AuthController@loginOrRegister')->name('login'); |
10 | 10 | } |
11 | - if (! \Route::has('register') ) { |
|
11 | + if (!\Route::has('register')) { |
|
12 | 12 | Route::get('register', 'Metrogistics\AzureSocialite\AuthController@loginOrRegister')->name('register'); |
13 | 13 | } |
14 | 14 | }); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::table('users', function (Blueprint $table) { |
|
16 | + Schema::table('users', function(Blueprint $table) { |
|
17 | 17 | // Users must be able to support blank passwords for external identity |
18 | 18 | $table->string('password')->nullable()->change(); |
19 | 19 | // We need a new string field to store the oauth provider unique id in |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | // Redirect requests to /api to the swagger documentation |
8 | 8 | //$api->any('', function (Illuminate\Http\Request $request) { |
9 | - $api->any('', function () { |
|
9 | + $api->any('', function() { |
|
10 | 10 | return redirect('api/documentation/'); |
11 | 11 | }); |
12 | 12 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * ) |
19 | 19 | **/ |
20 | 20 | |
21 | - $api->any('/api/hello', function () { |
|
21 | + $api->any('/api/hello', function() { |
|
22 | 22 | return 'hello world'; |
23 | 23 | }); |
24 | 24 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * ) |
26 | 26 | **/ |
27 | 27 | |
28 | -Route::middleware('api')->get('/hello', function (Request $request) { |
|
28 | +Route::middleware('api')->get('/hello', function(Request $request) { |
|
29 | 29 | return 'hello world'; |
30 | 30 | }); |
31 | 31 |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | use Illuminate\Foundation\Auth\User as Authenticatable; |
7 | 7 | |
8 | 8 | class User extends Authenticatable implements \Illuminate\Contracts\Auth\Authenticatable, |
9 | - \Illuminate\Contracts\Auth\Access\Authorizable, |
|
10 | - \Illuminate\Contracts\Auth\CanResetPassword, |
|
11 | - \Tymon\JWTAuth\Contracts\JWTSubject |
|
9 | + \Illuminate\Contracts\Auth\Access\Authorizable, |
|
10 | + \Illuminate\Contracts\Auth\CanResetPassword, |
|
11 | + \Tymon\JWTAuth\Contracts\JWTSubject |
|
12 | 12 | { |
13 | 13 | use Notifiable; |
14 | 14 | use \Silber\Bouncer\Database\HasRolesAndAbilities; |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | ]; |
33 | 33 | |
34 | 34 | /** |
35 | - * @return mixed |
|
36 | - */ |
|
35 | + * @return mixed |
|
36 | + */ |
|
37 | 37 | public function getJWTIdentifier() |
38 | 38 | { |
39 | 39 | return $this->getKey(); |
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | - * @return array |
|
44 | - */ |
|
43 | + * @return array |
|
44 | + */ |
|
45 | 45 | public function getJWTCustomClaims() |
46 | 46 | { |
47 | 47 | return ['user' => ['id' => $this->id]]; |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | $new_user->$id_field = $azure_user->id; |
23 | 23 | //$new_user->password = bcrypt(''); |
24 | 24 | |
25 | - foreach($user_map as $azure_field => $user_field){ |
|
25 | + foreach ($user_map as $azure_field => $user_field) { |
|
26 | 26 | $new_user->$user_field = $azure_user->$azure_field; |
27 | 27 | } |
28 | 28 | |
29 | 29 | $callback = static::$user_callback; |
30 | 30 | |
31 | - if($callback && is_callable($callback)){ |
|
31 | + if ($callback && is_callable($callback)) { |
|
32 | 32 | $callback($new_user); |
33 | 33 | } |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public static function userCallback($callback) |
41 | 41 | { |
42 | - if(! is_callable($callback)){ |
|
42 | + if (!is_callable($callback)) { |
|
43 | 43 | throw new \Exception("Must provide a callable."); |
44 | 44 | } |
45 | 45 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | */ |
57 | 57 | public function user() |
58 | 58 | { |
59 | - if($this->user){ |
|
59 | + if ($this->user) { |
|
60 | 60 | return $this->user; |
61 | 61 | } |
62 | 62 |
@@ -98,7 +98,7 @@ |
||
98 | 98 | * Get the ID for the currently authenticated user. |
99 | 99 | * |
100 | 100 | * @return string|null |
101 | - */ |
|
101 | + */ |
|
102 | 102 | public function id() |
103 | 103 | { |
104 | 104 | if ($user = $this->user()) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function check() |
58 | 58 | { |
59 | - return ! is_null($this->user()); |
|
59 | + return !is_null($this->user()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function guest() |
68 | 68 | { |
69 | - return ! $this->check(); |
|
69 | + return !$this->check(); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function user() |
78 | 78 | { |
79 | - if (! is_null($this->user)) { |
|
79 | + if (!is_null($this->user)) { |
|
80 | 80 | return $this->user; |
81 | 81 | } |
82 | 82 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return bool |
113 | 113 | */ |
114 | - public function validate(Array $credentials=[]) |
|
114 | + public function validate(Array $credentials = []) |
|
115 | 115 | { |
116 | 116 | return is_null($this->user); |
117 | 117 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $azureadgroups = $this->getUserGroupsByToken($token); |
61 | 61 | // only proceed if we got a good response with group info |
62 | 62 | if (isset($azureadgroups['value']) && count($azureadgroups['value'])) { |
63 | - foreach($azureadgroups['value'] as $group) { |
|
63 | + foreach ($azureadgroups['value'] as $group) { |
|
64 | 64 | $groups[] = $group['displayName']; |
65 | 65 | } |
66 | 66 | } |