@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $app_id = $appData->azp; |
| 101 | 101 | $app = \Metaclassing\EnterpriseAuth\Models\AzureApp::where('app_id', $app_id)->first(); |
| 102 | 102 | // If we dont have an existing app go create one |
| 103 | - if (! $app) { |
|
| 103 | + if (!$app) { |
|
| 104 | 104 | $azureApp = [ |
| 105 | 105 | 'name' => $app_id, |
| 106 | 106 | 'app_id' => $app_id, |
@@ -117,16 +117,16 @@ discard block |
||
| 117 | 117 | // Unpack our jwt to verify it is correctly formed |
| 118 | 118 | $token = $this->unpackJwt($accessToken); |
| 119 | 119 | // app tokens must be signed in RSA |
| 120 | - if (! isset($token['header']['alg']) || $token['header']['alg'] != 'RS256') { |
|
| 120 | + if (!isset($token['header']['alg']) || $token['header']['alg'] != 'RS256') { |
|
| 121 | 121 | throw new \Exception('Token is not using the correct signing algorithm RS256 '.$accessToken); |
| 122 | 122 | } |
| 123 | 123 | // app tokens are RSA signed with a key ID in the header of the token |
| 124 | - if (! isset($token['header']['kid'])) { |
|
| 124 | + if (!isset($token['header']['kid'])) { |
|
| 125 | 125 | throw new \Exception('Token with unknown RSA key id can not be validated '.$accessToken); |
| 126 | 126 | } |
| 127 | 127 | // Make sure the key id is known to our azure ad information |
| 128 | 128 | $kid = $token['header']['kid']; |
| 129 | - if (! isset($this->azureActiveDirectory->signingKeys[$kid])) { |
|
| 129 | + if (!isset($this->azureActiveDirectory->signingKeys[$kid])) { |
|
| 130 | 130 | throw new \Exception('Token signed with unknown KID '.$kid); |
| 131 | 131 | } |
| 132 | 132 | // get the x509 encoded cert body |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $roles = $user->roles()->get()->all(); |
| 204 | 204 | foreach ($roles as $key => $role) { |
| 205 | 205 | $role->permissions = $role->abilities()->get()->all(); |
| 206 | - if (! count($role->permissions)) { |
|
| 206 | + if (!count($role->permissions)) { |
|
| 207 | 207 | unset($roles[$key]); |
| 208 | 208 | } |
| 209 | 209 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function scrubMicrosoftGraphUserData($userData) |
| 50 | 50 | { |
| 51 | 51 | // Fix any stupid crap with missing or null fields |
| 52 | - if (! isset($userData['mail']) || ! $userData['mail']) { |
|
| 52 | + if (!isset($userData['mail']) || !$userData['mail']) { |
|
| 53 | 53 | $userData['mail'] = $userData['userPrincipalName']; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | // Try to find an existing user |
| 65 | 65 | $user = $userType::where($userIdField, $userData['id'])->first(); |
| 66 | 66 | // If we dont have an existing user |
| 67 | - if (! $user) { |
|
| 67 | + if (!$user) { |
|
| 68 | 68 | // Go create a new one with this data |
| 69 | 69 | $user = $this->createUserFromAzureData($userData); |
| 70 | 70 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | // TODO: rewrite this so that if the user doesnt exist we create them and get their groups from AAD |
| 106 | 106 | $user = $user_class::where('userPrincipalName', $upn)->first(); |
| 107 | - if (! $user) { |
|
| 107 | + if (!$user) { |
|
| 108 | 108 | throw new \Exception('No user found with user principal name '.$upn); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | public function loadClientCertFromWebserver() |
| 115 | 115 | { |
| 116 | 116 | // Make sure we got a client certificate from the web server |
| 117 | - if (! $_SERVER['SSL_CLIENT_CERT']) { |
|
| 117 | + if (!$_SERVER['SSL_CLIENT_CERT']) { |
|
| 118 | 118 | throw new \Exception('TLS client certificate missing'); |
| 119 | 119 | } |
| 120 | 120 | // try to parse the certificate we got |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | public function getUserPrincipalNameFromClientCert($x509) |
| 129 | 129 | { |
| 130 | 130 | $names = $x509->getExtension('id-ce-subjectAltName'); |
| 131 | - if (! $names) { |
|
| 131 | + if (!$names) { |
|
| 132 | 132 | throw new \Exception('TLS client cert missing subject alternative names'); |
| 133 | 133 | } |
| 134 | 134 | // Search subject alt names for user principal name |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | - if (! $upn) { |
|
| 145 | + if (!$upn) { |
|
| 146 | 146 | throw new \Exception('Could not find user principal name in TLS client cert'); |
| 147 | 147 | } |
| 148 | 148 | return $upn; |