@@ -4,7 +4,7 @@ |
||
| 4 | 4 | * Routes which is neccessary for the SSO server. |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -Route::middleware('api')->prefix('api/sso')->group(function () { |
|
| 7 | +Route::middleware('api')->prefix('api/sso')->group(function() { |
|
| 8 | 8 | Route::post('login', 'Zefy\LaravelSSO\Controllers\ServerController@login'); |
| 9 | 9 | Route::post('logout', 'Zefy\LaravelSSO\Controllers\ServerController@logout'); |
| 10 | 10 | Route::get('attach', 'Zefy\LaravelSSO\Controllers\ServerController@attach'); |
@@ -101,7 +101,7 @@ |
||
| 101 | 101 | |
| 102 | 102 | $headers = [ |
| 103 | 103 | 'Accept' => 'application/json', |
| 104 | - 'Authorization' => 'Bearer '. $this->getSessionId(), |
|
| 104 | + 'Authorization' => 'Bearer ' . $this->getSessionId(), |
|
| 105 | 105 | ]; |
| 106 | 106 | |
| 107 | 107 | switch ($method) { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | $this->publishConfig(__DIR__ . '/../config/' . $this->configFileName); |
| 25 | 25 | |
| 26 | - $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
| 26 | + $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
| 27 | 27 | |
| 28 | 28 | if ($this->app->runningInConsole()) { |
| 29 | 29 | $this->commands([ |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | // If this page is server, load routes which is required for the server. |
| 77 | 77 | if (config('laravel-sso.type') == 'server') { |
| 78 | - $this->loadRoutesFrom(__DIR__.'/Routes/server.php'); |
|
| 78 | + $this->loadRoutesFrom(__DIR__ . '/Routes/server.php'); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create(config('laravel-sso.brokersTable', 'brokers'), function (Blueprint $table) { |
|
| 16 | + Schema::create(config('laravel-sso.brokersTable', 'brokers'), function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->string('name')->unique(); |
| 19 | 19 | $table->string('secret'); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create(config('laravel-sso.brokerUserTable', 'broker_user'), function (Blueprint $table) { |
|
| 16 | + Schema::create(config('laravel-sso.brokerUserTable', 'broker_user'), function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | |
| 19 | 19 | $table->integer('user_id')->foreign('user_id')->references('id')->on('users'); |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $userInfo = $this->userInfo(); |
| 108 | 108 | $broker = $this->getBrokerDetail(); |
| 109 | - if(!empty($userInfo->id) && !empty($broker)) { |
|
| 109 | + if (!empty($userInfo->id) && !empty($broker)) { |
|
| 110 | 110 | $brokerUser = config('laravel-sso.brokersUserModel')::where('user_id', $userInfo->id)->where('broker_id', $broker->id)->first(); |
| 111 | - if(empty($brokerUser)) { |
|
| 111 | + if (empty($brokerUser)) { |
|
| 112 | 112 | return false; |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | public function checkUserApplicationAuth() |
| 124 | 124 | { |
| 125 | 125 | try { |
| 126 | - if(empty($this->checkBrokerUserAuthentication())) { |
|
| 126 | + if (empty($this->checkBrokerUserAuthentication())) { |
|
| 127 | 127 | $this->fail('User authorization failed with application.'); |
| 128 | 128 | } |
| 129 | 129 | } catch (SSOServerException $e) { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | protected function getBrokerSessionId() |
| 181 | 181 | { |
| 182 | 182 | $authorization = request()->header('Authorization', null); |
| 183 | - if ($authorization && strpos($authorization, 'Bearer') === 0) { |
|
| 183 | + if ($authorization && strpos($authorization, 'Bearer') === 0) { |
|
| 184 | 184 | return substr($authorization, 7); |
| 185 | 185 | } |
| 186 | 186 | |