@@ -23,9 +23,9 @@ |
||
| 23 | 23 | if (count($user->groups)) { |
| 24 | 24 | // remove the users existing database roles before assigning new ones |
| 25 | 25 | \DB::table('assigned_roles') |
| 26 | - ->where('entity_id', $authUser->id) |
|
| 27 | - ->where('entity_type', get_class($authUser)) |
|
| 28 | - ->delete(); |
|
| 26 | + ->where('entity_id', $authUser->id) |
|
| 27 | + ->where('entity_type', get_class($authUser)) |
|
| 28 | + ->delete(); |
|
| 29 | 29 | // add the user to each group they are assigned |
| 30 | 30 | $authUser->assign($user->groups); |
| 31 | 31 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | protected function mapUserToObject(array $user) |
| 111 | 111 | { |
| 112 | - if (! $user['mail']) { |
|
| 112 | + if (!$user['mail']) { |
|
| 113 | 113 | $user['mail'] = $user['userPrincipalName']; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $roles = $user->roles()->get()->all(); |
| 154 | 154 | foreach ($roles as $key => $role) { |
| 155 | 155 | $role->permissions = $role->abilities()->get()->all(); |
| 156 | - if (! count($role->permissions)) { |
|
| 156 | + if (!count($role->permissions)) { |
|
| 157 | 157 | unset($roles[$key]); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Authenticated user information routes |
| 4 | -Route::middleware([config('azure-oath.apiroutes.middleware'), config('azure-oath.apiroutes.authmiddleware')])->group(function () { |
|
| 4 | +Route::middleware([config('azure-oath.apiroutes.middleware'), config('azure-oath.apiroutes.authmiddleware')])->group(function() { |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * @SWG\Get( |
@@ -22,19 +22,19 @@ discard block |
||
| 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 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]); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | __DIR__.'/../publish/config/azure-oath.php', 'azure-oath' |
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | - $this->app['Laravel\Socialite\Contracts\Factory']->extend('azure-oauth', function ($app) { |
|
| 53 | + $this->app['Laravel\Socialite\Contracts\Factory']->extend('azure-oauth', function($app) { |
|
| 54 | 54 | return $app['Laravel\Socialite\Contracts\Factory']->buildProvider( |
| 55 | 55 | 'Metrogistics\AzureSocialite\AzureOauthProvider', |
| 56 | 56 | config('azure-oath.credentials') |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | // If the routes files for the swagger oauth config is NOT present, and we have all the right info, then generate it really quick |
| 64 | 64 | $swaggerAzureadFile = __DIR__.'/../routes/swagger.azuread.php'; |
| 65 | - if (! file_exists($swaggerAzureadFile) && env('AZURE_AD_CLIENT_ID') && env('AZURE_AD_OPENID_URL')) { |
|
| 65 | + if (!file_exists($swaggerAzureadFile) && env('AZURE_AD_CLIENT_ID') && env('AZURE_AD_OPENID_URL')) { |
|
| 66 | 66 | $openidConfig = $this->getOpenidConfiguration(env('AZURE_AD_OPENID_URL')); |
| 67 | 67 | $authorizationUrl = $openidConfig['authorization_endpoint']; |
| 68 | - if (! $authorizationUrl) { |
|
| 68 | + if (!$authorizationUrl) { |
|
| 69 | 69 | throw new \Exception('Error building swagger oauth config, azure ad openid url didnt give me an authorization url!'); |
| 70 | 70 | } |
| 71 | 71 | $client_id = env('AZURE_AD_CLIENT_ID'); |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | if (count($user->groups)) { |
| 24 | 24 | // remove the users existing database roles before assigning new ones |
| 25 | 25 | \DB::table('assigned_roles') |
| 26 | - ->where('entity_id', $authUser->id) |
|
| 27 | - ->where('entity_type', get_class($authUser)) |
|
| 28 | - ->delete(); |
|
| 26 | + ->where('entity_id', $authUser->id) |
|
| 27 | + ->where('entity_type', get_class($authUser)) |
|
| 28 | + ->delete(); |
|
| 29 | 29 | // add the user to each group they are assigned |
| 30 | 30 | $authUser->assign($user->groups); |
| 31 | 31 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | // Check to see if there is an intended destination url saved |
| 40 | 40 | $destination = $request->session() |
| 41 | - ->get('oauthIntendedUrl'); |
|
| 41 | + ->get('oauthIntendedUrl'); |
|
| 42 | 42 | // If there is no intended destination url, use the default |
| 43 | 43 | if (! $destination) { |
| 44 | 44 | $destination = config('azure-oath.redirect_on_login'); |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $destination = $request->session() |
| 41 | 41 | ->get('oauthIntendedUrl'); |
| 42 | 42 | // If there is no intended destination url, use the default |
| 43 | - if (! $destination) { |
|
| 43 | + if (!$destination) { |
|
| 44 | 44 | $destination = config('azure-oath.redirect_on_login'); |
| 45 | 45 | } |
| 46 | 46 | \Illuminate\Support\Facades\Log::info('AUTH success USER ID '.$authUser->id.' with redirect url '.$destination); |
@@ -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 | return $this->accessToken; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | // Include version before any pieces of the url |
| 77 | 77 | array_unshift($pieces, $this->graphApiVersion); |
| 78 | 78 | // Build the url |
| 79 | - foreach($pieces as $piece) { |
|
| 79 | + foreach ($pieces as $piece) { |
|
| 80 | 80 | $url .= '/'.$piece; |
| 81 | 81 | } |
| 82 | 82 | return $url; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | $parsed = []; |
| 125 | 125 | if (isset($graphData[$key]) && is_array($graphData[$key])) { |
| 126 | - foreach($graphData[$key] as $value) { |
|
| 126 | + foreach ($graphData[$key] as $value) { |
|
| 127 | 127 | if (isset($value[$property]) && $value[$property]) { |
| 128 | 128 | $parsed[$value[$property]] = $value; |
| 129 | 129 | } |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | // Make sure the tenant is formatted like xyzcorp.onmicrosoft.com |
| 37 | 37 | $regex = '/\.onmicrosoft\.com/'; |
| 38 | 38 | if (! preg_match($regex, $tenantName, $hits)) { |
| 39 | - // Append the suffix if it is missing |
|
| 40 | - $tenantName .= '.onmicrosoft.com'; |
|
| 39 | + // Append the suffix if it is missing |
|
| 40 | + $tenantName .= '.onmicrosoft.com'; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | $this->tenantName = $tenantName; |
@@ -46,9 +46,9 @@ discard block |
||
| 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 @@ 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 | } |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | public function buildOpenIdConfigUrl() |
| 47 | 47 | { |
| 48 | - $this->openIdConfigUrl = $this->baseUrl . '/' |
|
| 49 | - . $this->tenantName . '/' |
|
| 50 | - . $this->version . '/' |
|
| 48 | + $this->openIdConfigUrl = $this->baseUrl.'/' |
|
| 49 | + . $this->tenantName.'/' |
|
| 50 | + . $this->version.'/' |
|
| 51 | 51 | . $this->wellKnownOpenIdConfig; |
| 52 | 52 | } |
| 53 | 53 | |