@@ -35,7 +35,7 @@ discard block |
||
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 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $keyData = json_decode($json, true); |
81 | 81 | $keyRing = $keyData['keys']; |
82 | 82 | // Loop through the keys and build us an index by kid |
83 | - foreach($keyRing as $key) { |
|
83 | + foreach ($keyRing as $key) { |
|
84 | 84 | $this->signingKeys[$key['kid']] = $key; |
85 | 85 | } |
86 | 86 | } |
@@ -133,8 +133,8 @@ |
||
133 | 133 | } |
134 | 134 | // Get the X509 certificate for the selected key id |
135 | 135 | $certificate = '-----BEGIN CERTIFICATE-----'.PHP_EOL |
136 | - . $x5c . PHP_EOL |
|
137 | - . '-----END CERTIFICATE-----'; |
|
136 | + . $x5c . PHP_EOL |
|
137 | + . '-----END CERTIFICATE-----'; |
|
138 | 138 | // Perform the verification and get the verified payload results |
139 | 139 | $payload = \Firebase\JWT\JWT::decode($accessToken, $certificate, array('RS256')); |
140 | 140 |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $app_id = $appData->azp; |
98 | 98 | $app = \Metaclassing\EnterpriseAuth\Models\AzureApp::where('app_id', $app_id)->first(); |
99 | 99 | // If we dont have an existing app go create one |
100 | - if (! $app) { |
|
100 | + if (!$app) { |
|
101 | 101 | $app = \Metaclassing\EnterpriseAuth\Models\AzureApp::create(); |
102 | 102 | $app->name = $app_id; |
103 | 103 | $app->app_id = $app_id; |
@@ -113,16 +113,16 @@ discard block |
||
113 | 113 | // Unpack our jwt to verify it is correctly formed |
114 | 114 | $token = $this->unpackJwt($accessToken); |
115 | 115 | // app tokens must be signed in RSA |
116 | - if (! isset($token['header']['alg']) || $token['header']['alg'] != 'RS256') { |
|
116 | + if (!isset($token['header']['alg']) || $token['header']['alg'] != 'RS256') { |
|
117 | 117 | throw new \Exception('Token is not using the correct signing algorithm RS256 '.$accessToken); |
118 | 118 | } |
119 | 119 | // app tokens are RSA signed with a key ID in the header of the token |
120 | - if (! isset($token['header']['kid'])) { |
|
120 | + if (!isset($token['header']['kid'])) { |
|
121 | 121 | throw new \Exception('Token with unknown RSA key id can not be validated '.$accessToken); |
122 | 122 | } |
123 | 123 | // Make sure the key id is known to our azure ad information |
124 | 124 | $kid = $token['header']['kid']; |
125 | - if (! isset($this->azureActiveDirectory->signingKeys[$kid])) { |
|
125 | + if (!isset($this->azureActiveDirectory->signingKeys[$kid])) { |
|
126 | 126 | throw new \Exception('Token signed with unknown KID '.$kid); |
127 | 127 | } |
128 | 128 | // get the x509 encoded cert body |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | // Get the X509 certificate for the selected key id |
135 | 135 | $certificate = '-----BEGIN CERTIFICATE-----'.PHP_EOL |
136 | - . $x5c . PHP_EOL |
|
136 | + . $x5c.PHP_EOL |
|
137 | 137 | . '-----END CERTIFICATE-----'; |
138 | 138 | // Perform the verification and get the verified payload results |
139 | 139 | $payload = \Firebase\JWT\JWT::decode($accessToken, $certificate, array('RS256')); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $roles = $user->roles()->get()->all(); |
200 | 200 | foreach ($roles as $key => $role) { |
201 | 201 | $role->permissions = $role->abilities()->get()->all(); |
202 | - if (! count($role->permissions)) { |
|
202 | + if (!count($role->permissions)) { |
|
203 | 203 | unset($roles[$key]); |
204 | 204 | } |
205 | 205 | } |