@@ -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 |
@@ -39,7 +39,7 @@ |
||
| 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 | |
@@ -7,9 +7,9 @@ |
||
| 7 | 7 | |
| 8 | 8 | class User extends Authenticatable implements |
| 9 | 9 | \Illuminate\Contracts\Auth\Authenticatable, |
| 10 | - \Illuminate\Contracts\Auth\Access\Authorizable, |
|
| 11 | - \Illuminate\Contracts\Auth\CanResetPassword, |
|
| 12 | - \Tymon\JWTAuth\Contracts\JWTSubject |
|
| 10 | + \Illuminate\Contracts\Auth\Access\Authorizable, |
|
| 11 | + \Illuminate\Contracts\Auth\CanResetPassword, |
|
| 12 | + \Tymon\JWTAuth\Contracts\JWTSubject |
|
| 13 | 13 | { |
| 14 | 14 | use Notifiable; |
| 15 | 15 | use \Silber\Bouncer\Database\HasRolesAndAbilities; |
@@ -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 | |
@@ -17,6 +17,6 @@ discard block |
||
| 17 | 17 | * @SWG\Response(response="200", description="Hello world example") |
| 18 | 18 | * ) |
| 19 | 19 | **/ |
| 20 | - $api->any('/api/hello', function () { |
|
| 20 | + $api->any('/api/hello', function() { |
|
| 21 | 21 | return 'hello world'; |
| 22 | 22 | }); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * @SWG\Response(response="200", description="Hello world example") |
| 25 | 25 | * ) |
| 26 | 26 | **/ |
| 27 | -Route::middleware('api')->get('/hello', function (Request $request) { |
|
| 27 | +Route::middleware('api')->get('/hello', function(Request $request) { |
|
| 28 | 28 | return 'hello world'; |
| 29 | 29 | }); |
| 30 | 30 | |
@@ -46,9 +46,9 @@ |
||
| 46 | 46 | public function buildOpenIdConfigUrl() |
| 47 | 47 | { |
| 48 | 48 | $this->openIdConfigUrl = $this->baseUrl.'/' |
| 49 | - .$this->tenantName.'/' |
|
| 50 | - .$this->version.'/' |
|
| 51 | - .$this->wellKnownOpenIdConfig; |
|
| 49 | + .$this->tenantName.'/' |
|
| 50 | + .$this->version.'/' |
|
| 51 | + .$this->wellKnownOpenIdConfig; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function downloadOpenIdConfig() |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | if ($tenantName != 'common') { |
| 36 | 36 | // Make sure the tenant is formatted like xyzcorp.onmicrosoft.com |
| 37 | 37 | $regex = '/\.onmicrosoft\.com/'; |
| 38 | - if (! preg_match($regex, $tenantName, $hits)) { |
|
| 38 | + if (!preg_match($regex, $tenantName, $hits)) { |
|
| 39 | 39 | // Append the suffix if it is missing |
| 40 | 40 | $tenantName .= '.onmicrosoft.com'; |
| 41 | 41 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | public function __construct($azureActiveDirectory) |
| 14 | 14 | { |
| 15 | 15 | // IF they didnt pre-populate all our AAD stuff then make a new one for the common tenant |
| 16 | - if (! $azureActiveDirectory) { |
|
| 16 | + if (!$azureActiveDirectory) { |
|
| 17 | 17 | $azureActiveDirectory = new AzureActiveDirectory(); |
| 18 | 18 | } |
| 19 | 19 | $this->azureActiveDirectory = $azureActiveDirectory; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | protected function getAccessToken() |
| 29 | 29 | { |
| 30 | - if (! $this->accessToken) { |
|
| 30 | + if (!$this->accessToken) { |
|
| 31 | 31 | $this->authenticateAsApplication(); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function check() |
| 59 | 59 | { |
| 60 | - return ! is_null($this->user()); |
|
| 60 | + return !is_null($this->user()); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function guest() |
| 69 | 69 | { |
| 70 | - return ! $this->check(); |
|
| 70 | + return !$this->check(); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function user() |
| 79 | 79 | { |
| 80 | - if (! is_null($this->user)) { |
|
| 80 | + if (!is_null($this->user)) { |
|
| 81 | 81 | return $this->user; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | $graph = new \Microsoft\Graph\Graph(); |
| 40 | 40 | $graph->setAccessToken($accessToken); |
| 41 | 41 | $user = $graph->createRequest("GET", "/me") |
| 42 | - ->setReturnType(\Microsoft\Graph\Model\User::class) |
|
| 43 | - ->execute(); |
|
| 42 | + ->setReturnType(\Microsoft\Graph\Model\User::class) |
|
| 43 | + ->execute(); |
|
| 44 | 44 | |
| 45 | 45 | return $user->jsonSerialize(); |
| 46 | 46 | } |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | if (count($groups)) { |
| 132 | 132 | // remove the users existing database roles before assigning new ones |
| 133 | 133 | \DB::table('assigned_roles') |
| 134 | - ->where('entity_id', $user->id) |
|
| 135 | - ->where('entity_type', get_class($user)) |
|
| 136 | - ->delete(); |
|
| 134 | + ->where('entity_id', $user->id) |
|
| 135 | + ->where('entity_type', get_class($user)) |
|
| 136 | + ->delete(); |
|
| 137 | 137 | // add the user to each group they are assigned |
| 138 | 138 | $user->assign($groups); |
| 139 | 139 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | public function scrubMicrosoftGraphUserData($userData) |
| 49 | 49 | { |
| 50 | 50 | // Fix any stupid crap with missing or null fields |
| 51 | - if (! isset($userData['mail']) || !$userData['mail']) { |
|
| 51 | + if (!isset($userData['mail']) || !$userData['mail']) { |
|
| 52 | 52 | $userData['mail'] = $userData['userPrincipalName']; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | // Try to find an existing user |
| 70 | 70 | $user = $userType::where($userIdField, $userData['id'])->first(); |
| 71 | 71 | // If we dont have an existing user |
| 72 | - if (! $user) { |
|
| 72 | + if (!$user) { |
|
| 73 | 73 | // Go create a new one with this data |
| 74 | 74 | $UserFactory = new UserFactory(); |
| 75 | 75 | $user = $UserFactory->convertAzureUser($userData); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | public function certAuth() |
| 82 | 82 | { |
| 83 | 83 | // Make sure we got a client certificate from the web server |
| 84 | - if (! $_SERVER['SSL_CLIENT_CERT']) { |
|
| 84 | + if (!$_SERVER['SSL_CLIENT_CERT']) { |
|
| 85 | 85 | throw new \Exception('TLS client certificate missing'); |
| 86 | 86 | } |
| 87 | 87 | // try to parse the certificate we got |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $asciicert = str_replace("\t", '', $_SERVER['SSL_CLIENT_CERT']); |
| 91 | 91 | $cert = $x509->loadX509($asciicert); |
| 92 | 92 | $names = $x509->getExtension('id-ce-subjectAltName'); |
| 93 | - if (! $names) { |
|
| 93 | + if (!$names) { |
|
| 94 | 94 | throw new \Exception('TLS client cert missing subject alternative names'); |
| 95 | 95 | } |
| 96 | 96 | // Search subject alt names for user principal name |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - if (! $upn) { |
|
| 107 | + if (!$upn) { |
|
| 108 | 108 | throw new \Exception('Could not find user principal name in TLS client cert'); |
| 109 | 109 | } |
| 110 | 110 | $user_class = config('enterpriseauth.user_class'); |
| 111 | 111 | $user = $user_class::where('userPrincipalName', $upn)->first(); |
| 112 | - if (! $user) { |
|
| 112 | + if (!$user) { |
|
| 113 | 113 | throw new \Exception('No user found with user principal name '.$upn); |
| 114 | 114 | } |
| 115 | 115 | //dd($user); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | // Process group data into a list of displayNames we use as roles |
| 125 | 125 | $groups = []; |
| 126 | - foreach($groupData as $info) { |
|
| 126 | + foreach ($groupData as $info) { |
|
| 127 | 127 | $groups[] = $info['displayName']; |
| 128 | 128 | } |
| 129 | 129 | |