@@ -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 |
@@ -18,12 +18,12 @@ |
||
| 18 | 18 | $table->string('password')->nullable()->change(); |
| 19 | 19 | // We need a new string field to store the oauth provider unique id in |
| 20 | 20 | $table->string('azure_id', 36) |
| 21 | - ->nullable() |
|
| 22 | - ->after('email'); |
|
| 21 | + ->nullable() |
|
| 22 | + ->after('email'); |
|
| 23 | 23 | // We need a new string field to store the user principal name in |
| 24 | 24 | $table->string('userPrincipalName') |
| 25 | - ->nullable() |
|
| 26 | - ->after('azure_id'); |
|
| 25 | + ->nullable() |
|
| 26 | + ->after('azure_id'); |
|
| 27 | 27 | }); |
| 28 | 28 | // We dont support password resets because social identity is external |
| 29 | 29 | Schema::dropIfExists('password_resets'); |
@@ -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 | |
@@ -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 | } |
@@ -46,18 +46,18 @@ |
||
| 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 buildAdminConsentUrl($clientId, $redirectUri) |
| 55 | 55 | { |
| 56 | 56 | $url = $this->baseUrl.'/' |
| 57 | - .$this->tenantName.'/' |
|
| 58 | - .'adminconsent' |
|
| 59 | - .'?client_id='.$clientId |
|
| 60 | - .'&redirect_uri='.$redirectUri; |
|
| 57 | + .$this->tenantName.'/' |
|
| 58 | + .'adminconsent' |
|
| 59 | + .'?client_id='.$clientId |
|
| 60 | + .'&redirect_uri='.$redirectUri; |
|
| 61 | 61 | |
| 62 | 62 | return $url; |
| 63 | 63 | } |
@@ -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 | } |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Authenticated user information routes |
| 4 | -Route::middleware([config('enterpriseauth.apiroutes.middleware'), config('enterpriseauth.apiroutes.authmiddleware')])->group(function () { |
|
| 4 | +Route::middleware([config('enterpriseauth.apiroutes.middleware'), config('enterpriseauth.apiroutes.authmiddleware')])->group(function() { |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * @SWG\Get( |
@@ -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); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public function redirectToOauthAdminConsent(\Illuminate\Http\Request $request) |
| 42 | 42 | { |
| 43 | 43 | $url = $this->azureActiveDirectory->buildAdminConsentUrl(config('enterpriseauth.credentials.client_id'), |
| 44 | - config('enterpriseauth.credentials.callback_url')); |
|
| 44 | + config('enterpriseauth.credentials.callback_url')); |
|
| 45 | 45 | //return new \Illuminate\Http\RedirectResponse($url); |
| 46 | 46 | return redirect($url); |
| 47 | 47 | } |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | public function buildAuthUrl() |
| 59 | 59 | { |
| 60 | 60 | $url = $this->azureActiveDirectory->authorizationEndpoint |
| 61 | - .'?' |
|
| 62 | - .$this->buildAuthUrlQueryString(); |
|
| 61 | + .'?' |
|
| 62 | + .$this->buildAuthUrlQueryString(); |
|
| 63 | 63 | |
| 64 | 64 | return $url; |
| 65 | 65 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | // Check to see if there is an intended destination url saved |
| 103 | 103 | $destination = $request->session() |
| 104 | - ->get('oauthIntendedUrl'); |
|
| 104 | + ->get('oauthIntendedUrl'); |
|
| 105 | 105 | // If there is no intended destination url, use the default |
| 106 | 106 | if (! $destination) { |
| 107 | 107 | $destination = config('enterpriseauth.redirect_on_login'); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | // Go through all the credential config and make sure they are set in the .env or config file |
| 48 | 48 | foreach (config('enterpriseauth.credentials') as $config => $env) { |
| 49 | 49 | // If one isnt set, throw a red flat until the person fixes it |
| 50 | - if (! config('enterpriseauth.credentials.'.$config)) { |
|
| 50 | + if (!config('enterpriseauth.credentials.'.$config)) { |
|
| 51 | 51 | throw new \Exception('enterpriseauth setup error: missing mandatory config value for enterpriseauth.credentials.'.$config.' check your .env file!'); |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | // Override the application configuration to use our oauth token guard driver at runtime |
| 60 | 60 | config(['auth.guards.api.driver' => 'oauthtoken']); |
| 61 | 61 | // Now I have a machine gun. ho ho ho! |
| 62 | - \Illuminate\Support\Facades\Auth::extend('oauthtoken', function ($app, $name, array $config) { |
|
| 62 | + \Illuminate\Support\Facades\Auth::extend('oauthtoken', function($app, $name, array $config) { |
|
| 63 | 63 | $userProvider = \Illuminate\Support\Facades\Auth::createUserProvider($config['provider']); |
| 64 | 64 | |
| 65 | 65 | return new \Metaclassing\EnterpriseAuth\Middleware\OauthTokenGuard($userProvider, $app->make('request')); |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | protected function configureSwaggerToScanEnterpriseAuthRouteFiles() |
| 70 | 70 | { |
| 71 | 71 | $swaggerScanPaths = config('l5-swagger.paths.annotations'); |
| 72 | - if (! is_array($swaggerScanPaths)) { |
|
| 72 | + if (!is_array($swaggerScanPaths)) { |
|
| 73 | 73 | $swaggerScanPaths = [$swaggerScanPaths]; |
| 74 | 74 | } |
| 75 | - if (! in_array(base_path('routes'), $swaggerScanPaths)) { |
|
| 75 | + if (!in_array(base_path('routes'), $swaggerScanPaths)) { |
|
| 76 | 76 | $swaggerScanPaths[] = base_path('routes'); |
| 77 | 77 | } |
| 78 | - if (! in_array(__DIR__.'/../routes/', $swaggerScanPaths)) { |
|
| 78 | + if (!in_array(__DIR__.'/../routes/', $swaggerScanPaths)) { |
|
| 79 | 79 | $swaggerScanPaths[] = __DIR__.'/../routes/'; |
| 80 | 80 | } |
| 81 | 81 | config(['l5-swagger.paths.annotations' => $swaggerScanPaths]); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | // If the routes files for the swagger oauth config is NOT present, and we have all the right info, then generate it really quick |
| 87 | 87 | $swaggerAzureadFile = __DIR__.'/../routes/swagger.azuread.php'; |
| 88 | - if (! file_exists($swaggerAzureadFile)) { |
|
| 88 | + if (!file_exists($swaggerAzureadFile)) { |
|
| 89 | 89 | $aad = new AzureActiveDirectory(config('enterpriseauth.credentials.tenant')); |
| 90 | 90 | //$authorizationUrl = $aad->authorizationEndpoint . '?resource=https://graph.microsoft.com'; |
| 91 | 91 | $authorizationUrl = $aad->authorizationEndpoint; |
@@ -1,19 +1,19 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -Route::middleware([config('enterpriseauth.routes.middleware')])->group(function () { |
|
| 3 | +Route::middleware([config('enterpriseauth.routes.middleware')])->group(function() { |
|
| 4 | 4 | Route::get(config('enterpriseauth.routes.login'), 'Metaclassing\EnterpriseAuth\Controllers\WebAuthController@redirectToOauthProvider'); |
| 5 | 5 | Route::get(config('enterpriseauth.routes.logout'), 'Metaclassing\EnterpriseAuth\Controllers\WebAuthController@logoutFromOauthProvider'); |
| 6 | 6 | Route::get(config('enterpriseauth.routes.callback'), 'Metaclassing\EnterpriseAuth\Controllers\WebAuthController@handleOauthResponse'); |
| 7 | 7 | Route::get(config('enterpriseauth.routes.adminconsent'), 'Metaclassing\EnterpriseAuth\Controllers\WebAuthController@redirectToOauthAdminConsent'); |
| 8 | 8 | |
| 9 | 9 | // This handles a situation where a route with the NAME of login does not exist, we define it to keep from breaking framework redirects hard coded |
| 10 | - if (! \Route::has('login')) { |
|
| 10 | + if (!\Route::has('login')) { |
|
| 11 | 11 | Route::get('login', 'Metaclassing\EnterpriseAuth\Controllers\WebAuthController@loginOrRegister')->name('login'); |
| 12 | 12 | } |
| 13 | - if (! \Route::has('register')) { |
|
| 13 | + if (!\Route::has('register')) { |
|
| 14 | 14 | Route::get('register', 'Metaclassing\EnterpriseAuth\Controllers\WebAuthController@loginOrRegister')->name('register'); |
| 15 | 15 | } |
| 16 | - if (! \Route::has('logout')) { |
|
| 16 | + if (!\Route::has('logout')) { |
|
| 17 | 17 | Route::get('logout', 'Metaclassing\EnterpriseAuth\Controllers\WebAuthController@logout')->name('logout'); |
| 18 | 18 | } |
| 19 | 19 | }); |