@@ -44,9 +44,9 @@ |
||
| 44 | 44 | if(count($user->groups)) { |
| 45 | 45 | // remove the users existing database roles before assigning new ones |
| 46 | 46 | \DB::table('assigned_roles') |
| 47 | - ->where('entity_id', $authUser->id) |
|
| 48 | - ->where('entity_type', get_class($authUser)) |
|
| 49 | - ->delete(); |
|
| 47 | + ->where('entity_id', $authUser->id) |
|
| 48 | + ->where('entity_type', get_class($authUser)) |
|
| 49 | + ->delete(); |
|
| 50 | 50 | // add the user to each group they are assigned |
| 51 | 51 | $authUser->assign($user->groups); |
| 52 | 52 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | // IF the request has an Authorization: Bearer abc123 header |
| 26 | 26 | $header = $request->headers->get('authorization'); |
| 27 | 27 | $regex = '/bearer\s+(\S+)/i'; |
| 28 | - if ($header && preg_match($regex, $header, $matches) ) { |
|
| 28 | + if ($header && preg_match($regex, $header, $matches)) { |
|
| 29 | 29 | $oauthAccessToken = $matches[1]; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $authUser = $this->findOrCreateUser($user); |
| 42 | 42 | |
| 43 | 43 | // If we have user group information from this oauth attempt |
| 44 | - if(count($user->groups)) { |
|
| 44 | + if (count($user->groups)) { |
|
| 45 | 45 | // remove the users existing database roles before assigning new ones |
| 46 | 46 | \DB::table('assigned_roles') |
| 47 | 47 | ->where('entity_id', $authUser->id) |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | try { |
| 75 | 75 | // verify the credentials and create a token for the user |
| 76 | - if (! $token = \JWTAuth::fromUser($authUser)) { |
|
| 76 | + if (!$token = \JWTAuth::fromUser($authUser)) { |
|
| 77 | 77 | return response()->json(['error' => 'invalid_credentials'], 401); |
| 78 | 78 | } |
| 79 | 79 | } catch (JWTException $e) { |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $azureadgroups = $this->getUserGroupsByToken($token); |
| 124 | 124 | // only proceed if we got a good response with group info |
| 125 | 125 | if (isset($azureadgroups['value']) && count($azureadgroups['value'])) { |
| 126 | - foreach($azureadgroups['value'] as $group) { |
|
| 126 | + foreach ($azureadgroups['value'] as $group) { |
|
| 127 | 127 | $groups[] = $group['displayName']; |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | { |
| 179 | 179 | $user = auth()->user(); |
| 180 | 180 | $roles = $user->roles()->get()->all(); |
| 181 | - foreach($roles as $key => $role) { |
|
| 181 | + foreach ($roles as $key => $role) { |
|
| 182 | 182 | $role->permissions = $role->abilities()->get()->all(); |
| 183 | - if(!count($role->permissions)) { |
|
| 183 | + if (!count($role->permissions)) { |
|
| 184 | 184 | unset($roles[$key]); |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -24,9 +24,9 @@ |
||
| 24 | 24 | if(count($user->groups)) { |
| 25 | 25 | // remove the users existing database roles before assigning new ones |
| 26 | 26 | \DB::table('assigned_roles') |
| 27 | - ->where('entity_id', $authUser->id) |
|
| 28 | - ->where('entity_type', get_class($authUser)) |
|
| 29 | - ->delete(); |
|
| 27 | + ->where('entity_id', $authUser->id) |
|
| 28 | + ->where('entity_type', get_class($authUser)) |
|
| 29 | + ->delete(); |
|
| 30 | 30 | // add the user to each group they are assigned |
| 31 | 31 | $authUser->assign($user->groups); |
| 32 | 32 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $authUser = $this->findOrCreateUser($user); |
| 22 | 22 | |
| 23 | 23 | // If we have user group information from this oauth attempt |
| 24 | - if(count($user->groups)) { |
|
| 24 | + if (count($user->groups)) { |
|
| 25 | 25 | // remove the users existing database roles before assigning new ones |
| 26 | 26 | \DB::table('assigned_roles') |
| 27 | 27 | ->where('entity_id', $authUser->id) |
@@ -22,17 +22,17 @@ |
||
| 22 | 22 | return $UserFactory->convertAzureUser($user); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function loginOrRegister (\Illuminate\Http\Request $request) |
|
| 25 | + public function loginOrRegister(\Illuminate\Http\Request $request) |
|
| 26 | 26 | { |
| 27 | 27 | return $request->expectsJson() |
| 28 | 28 | ? response()->json(['message' => $exception->getMessage()], 401) |
| 29 | 29 | : redirect()->guest(config('azure-oath.routes.login')); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function certAuth () |
|
| 32 | + public function certAuth() |
|
| 33 | 33 | { |
| 34 | 34 | // Make sure we got a client certificate from the web server |
| 35 | - if (! $_SERVER['SSL_CLIENT_CERT']) { |
|
| 35 | + if (!$_SERVER['SSL_CLIENT_CERT']) { |
|
| 36 | 36 | throw new \Exception('TLS client certificate missing'); |
| 37 | 37 | } |
| 38 | 38 | // try to parse the certificate we got |