@@ -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 | |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | $destination = $request->session() |
| 73 | 73 | ->get('oauthIntendedUrl'); |
| 74 | 74 | // If there is no intended destination url, use the default |
| 75 | - if (! $destination) { |
|
| 75 | + if (!$destination) { |
|
| 76 | 76 | $destination = config('enterpriseauth.redirect_on_login'); |
| 77 | 77 | } |
| 78 | 78 | \Illuminate\Support\Facades\Log::info('AUTH success USER ID '.$user->id.' with redirect url '.$destination); |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | public function buildAuthUrl() |
| 40 | 40 | { |
| 41 | 41 | $url = $this->azureActiveDirectory->authorizationEndpoint |
| 42 | - .'?' |
|
| 43 | - .$this->buildAuthUrlQueryString(); |
|
| 42 | + .'?' |
|
| 43 | + .$this->buildAuthUrlQueryString(); |
|
| 44 | 44 | |
| 45 | 45 | return $url; |
| 46 | 46 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // Check to see if there is an intended destination url saved |
| 72 | 72 | $destination = $request->session() |
| 73 | - ->get('oauthIntendedUrl'); |
|
| 73 | + ->get('oauthIntendedUrl'); |
|
| 74 | 74 | // If there is no intended destination url, use the default |
| 75 | 75 | if (! $destination) { |
| 76 | 76 | $destination = config('enterpriseauth.redirect_on_login'); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | 'client_secret' => config('enterpriseauth.credentials.client_secret'), |
| 97 | 97 | 'redirect_uri' => config('enterpriseauth.credentials.callback_url'), |
| 98 | 98 | 'grant_type' => 'authorization_code', |
| 99 | - ], |
|
| 99 | + ], |
|
| 100 | 100 | ]; |
| 101 | 101 | $response = $guzzle->post($url, $parameters); |
| 102 | 102 | $responseObject = json_decode($response->getBody()); |
@@ -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 | } |
@@ -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 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | public function certAuth() |
| 97 | 97 | { |
| 98 | 98 | // Make sure we got a client certificate from the web server |
| 99 | - if (! $_SERVER['SSL_CLIENT_CERT']) { |
|
| 99 | + if (!$_SERVER['SSL_CLIENT_CERT']) { |
|
| 100 | 100 | throw new \Exception('TLS client certificate missing'); |
| 101 | 101 | } |
| 102 | 102 | // try to parse the certificate we got |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $asciicert = str_replace("\t", '', $_SERVER['SSL_CLIENT_CERT']); |
| 106 | 106 | $x509->loadX509($asciicert); |
| 107 | 107 | $names = $x509->getExtension('id-ce-subjectAltName'); |
| 108 | - if (! $names) { |
|
| 108 | + if (!$names) { |
|
| 109 | 109 | throw new \Exception('TLS client cert missing subject alternative names'); |
| 110 | 110 | } |
| 111 | 111 | // Search subject alt names for user principal name |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | - if (! $upn) { |
|
| 122 | + if (!$upn) { |
|
| 123 | 123 | throw new \Exception('Could not find user principal name in TLS client cert'); |
| 124 | 124 | } |
| 125 | 125 | $user_class = config('enterpriseauth.user_class'); |
| 126 | 126 | $user = $user_class::where('userPrincipalName', $upn)->first(); |
| 127 | - if (! $user) { |
|
| 127 | + if (!$user) { |
|
| 128 | 128 | throw new \Exception('No user found with user principal name '.$upn); |
| 129 | 129 | } |
| 130 | 130 | //dd($user); |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | $roles = $user->roles()->get()->all(); |
| 57 | 57 | foreach ($roles as $key => $role) { |
| 58 | 58 | $role->permissions = $role->abilities()->get()->all(); |
| 59 | - if (! count($role->permissions)) { |
|
| 59 | + if (!count($role->permissions)) { |
|
| 60 | 60 | unset($roles[$key]); |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -15,26 +15,26 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | // Make sure nobody is including or running this thing without all the required env settings |
| 17 | 17 | foreach (config('enterpriseauth.credentials') as $config => $env) { |
| 18 | - if (! config('enterpriseauth.credentials.'.$config)) { |
|
| 18 | + if (!config('enterpriseauth.credentials.'.$config)) { |
|
| 19 | 19 | throw new \Exception('enterpriseauth setup error: missing mandatory config value for enterpriseauth.credentials.'.$config.' check your .env file!'); |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | // Actually I have my own oauth token cache based authentication guard now lol |
| 24 | 24 | config(['auth.guards.api.driver' => 'oauthtoken']); |
| 25 | - Auth::extend('oauthtoken', function ($app, $name, array $config) { |
|
| 25 | + Auth::extend('oauthtoken', function($app, $name, array $config) { |
|
| 26 | 26 | return new \Metaclassing\EnterpriseAuth\Middleware\OauthTokenGuard(Auth::createUserProvider($config['provider']), $app->make('request')); |
| 27 | 27 | }); |
| 28 | 28 | |
| 29 | 29 | // Make sure that this vendor dir and the routes dir are in any scanned paths for swagger documentation |
| 30 | 30 | $swaggerScanPaths = config('l5-swagger.paths.annotations'); |
| 31 | - if (! is_array($swaggerScanPaths)) { |
|
| 31 | + if (!is_array($swaggerScanPaths)) { |
|
| 32 | 32 | $swaggerScanPaths = [$swaggerScanPaths]; |
| 33 | 33 | } |
| 34 | - if (! in_array(base_path('routes'), $swaggerScanPaths)) { |
|
| 34 | + if (!in_array(base_path('routes'), $swaggerScanPaths)) { |
|
| 35 | 35 | $swaggerScanPaths[] = base_path('routes'); |
| 36 | 36 | } |
| 37 | - if (! in_array(__DIR__.'/../routes/', $swaggerScanPaths)) { |
|
| 37 | + if (!in_array(__DIR__.'/../routes/', $swaggerScanPaths)) { |
|
| 38 | 38 | $swaggerScanPaths[] = __DIR__.'/../routes/'; |
| 39 | 39 | } |
| 40 | 40 | config(['l5-swagger.paths.annotations' => $swaggerScanPaths]); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | // If the routes files for the swagger oauth config is NOT present, and we have all the right info, then generate it really quick |
| 66 | 66 | $swaggerAzureadFile = __DIR__.'/../routes/swagger.azuread.php'; |
| 67 | - if (! file_exists($swaggerAzureadFile)) { |
|
| 67 | + if (!file_exists($swaggerAzureadFile)) { |
|
| 68 | 68 | $aad = new AzureActiveDirectory(config('enterpriseauth.credentials.tenant')); |
| 69 | 69 | //$authorizationUrl = $aad->authorizationEndpoint . '?resource=https://graph.microsoft.com'; |
| 70 | 70 | $authorizationUrl = $aad->authorizationEndpoint; |