@@ -46,7 +46,7 @@ |
||
46 | 46 | */ |
47 | 47 | public function guest() |
48 | 48 | { |
49 | - return ! $this->check(); |
|
49 | + return !$this->check(); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function certAuth() |
32 | 32 | { |
33 | 33 | // Make sure we got a client certificate from the web server |
34 | - if (! $_SERVER['SSL_CLIENT_CERT']) { |
|
34 | + if (!$_SERVER['SSL_CLIENT_CERT']) { |
|
35 | 35 | throw new \Exception('TLS client certificate missing'); |
36 | 36 | } |
37 | 37 | // try to parse the certificate we got |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $asciicert = str_replace("\t", '', $_SERVER['SSL_CLIENT_CERT']); |
41 | 41 | $cert = $x509->loadX509($asciicert); |
42 | 42 | $names = $x509->getExtension('id-ce-subjectAltName'); |
43 | - if (! $names) { |
|
43 | + if (!$names) { |
|
44 | 44 | throw new \Exception('TLS client cert missing subject alternative names'); |
45 | 45 | } |
46 | 46 | // Search subject alt names for user principal name |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
57 | - if (! $upn) { |
|
57 | + if (!$upn) { |
|
58 | 58 | throw new \Exception('Could not find user principal name in TLS client cert'); |
59 | 59 | } |
60 | 60 | $user_class = config('azure-oath.user_class'); |
61 | 61 | $user = $user_class::where('userPrincipalName', $upn)->first(); |
62 | - if (! $user) { |
|
62 | + if (!$user) { |
|
63 | 63 | throw new \Exception('No user found with user principal name '.$upn); |
64 | 64 | } |
65 | 65 | //dd($user); |
@@ -98,7 +98,7 @@ |
||
98 | 98 | { |
99 | 99 | //dd($user); |
100 | 100 | // WELL this is extremely stupid. if email address isnt set, use their UPN... |
101 | - if (! $user['mail']) { |
|
101 | + if (!$user['mail']) { |
|
102 | 102 | $user['mail'] = $user['userPrincipalName']; |
103 | 103 | } |
104 | 104 |
@@ -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 | } |
@@ -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 | } |
@@ -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 |
@@ -26,19 +26,19 @@ discard block |
||
26 | 26 | |
27 | 27 | // Actually I have my own oauth token cache based authentication guard now lol |
28 | 28 | config(['auth.guards.api.driver' => 'oauthtoken']); |
29 | - Auth::extend('oauthtoken', function ($app, $name, array $config) { |
|
29 | + Auth::extend('oauthtoken', function($app, $name, array $config) { |
|
30 | 30 | return new OauthTokenGuard(Auth::createUserProvider($config['provider']), $app->make('request')); |
31 | 31 | }); |
32 | 32 | |
33 | 33 | // Make sure that this vendor dir and the routes dir are in any scanned paths for swagger documentation |
34 | 34 | $swaggerScanPaths = config('l5-swagger.paths.annotations'); |
35 | - if (! is_array($swaggerScanPaths)) { |
|
35 | + if (!is_array($swaggerScanPaths)) { |
|
36 | 36 | $swaggerScanPaths = [$swaggerScanPaths]; |
37 | 37 | } |
38 | - if (! in_array(base_path('routes'), $swaggerScanPaths)) { |
|
38 | + if (!in_array(base_path('routes'), $swaggerScanPaths)) { |
|
39 | 39 | $swaggerScanPaths[] = base_path('routes'); |
40 | 40 | } |
41 | - if (! in_array(__DIR__.'/../routes/', $swaggerScanPaths)) { |
|
41 | + if (!in_array(__DIR__.'/../routes/', $swaggerScanPaths)) { |
|
42 | 42 | $swaggerScanPaths[] = __DIR__.'/../routes/'; |
43 | 43 | } |
44 | 44 | config(['l5-swagger.paths.annotations' => $swaggerScanPaths]); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | __DIR__.'/../publish/config/azure-oath.php', 'azure-oath' |
55 | 55 | ); |
56 | 56 | |
57 | - $this->app['Laravel\Socialite\Contracts\Factory']->extend('azure-oauth', function ($app) { |
|
57 | + $this->app['Laravel\Socialite\Contracts\Factory']->extend('azure-oauth', function($app) { |
|
58 | 58 | return $app['Laravel\Socialite\Contracts\Factory']->buildProvider( |
59 | 59 | 'Metrogistics\AzureSocialite\AzureOauthProvider', |
60 | 60 | config('azure-oath.credentials') |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | |
67 | 67 | // If the routes files for the swagger oauth config is NOT present, and we have all the right info, then generate it really quick |
68 | 68 | $swaggerAzureadFile = __DIR__.'/../routes/swagger.azuread.php'; |
69 | - if (! file_exists($swaggerAzureadFile) && env('AZURE_AD_CLIENT_ID') && env('AZURE_AD_OPENID_URL')) { |
|
69 | + if (!file_exists($swaggerAzureadFile) && env('AZURE_AD_CLIENT_ID') && env('AZURE_AD_OPENID_URL')) { |
|
70 | 70 | $openidConfig = $this->getOpenidConfiguration(env('AZURE_AD_OPENID_URL')); |
71 | 71 | $authorizationUrl = $openidConfig['authorization_endpoint']; |
72 | - if (! $authorizationUrl) { |
|
72 | + if (!$authorizationUrl) { |
|
73 | 73 | throw new \Exception('Error building swagger oauth config, azure ad openid url didnt give me an authorization url!'); |
74 | 74 | } |
75 | 75 | $client_id = env('AZURE_AD_CLIENT_ID'); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $oauthAccessToken = $this->extractOauthAccessTokenFromRequest($request); |
64 | 64 | |
65 | 65 | // If we cant find ANY token to use, abort. |
66 | - if (! $oauthAccessToken) { |
|
66 | + if (!$oauthAccessToken) { |
|
67 | 67 | throw new \Exception('error: token/access_token/authorization bearer token is missing'); |
68 | 68 | } |
69 | 69 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | try { |
74 | 74 | // verify the credentials and create a token for the user |
75 | - if (! $token = \JWTAuth::fromUser($authUser)) { |
|
75 | + if (!$token = \JWTAuth::fromUser($authUser)) { |
|
76 | 76 | return response()->json(['error' => 'invalid_credentials'], 401); |
77 | 77 | } |
78 | 78 | } catch (JWTException $e) { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | protected function mapUserToObject(array $user) |
142 | 142 | { |
143 | - if (! $user['mail']) { |
|
143 | + if (!$user['mail']) { |
|
144 | 144 | $user['mail'] = $user['userPrincipalName']; |
145 | 145 | } |
146 | 146 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $roles = $user->roles()->get()->all(); |
185 | 185 | foreach ($roles as $key => $role) { |
186 | 186 | $role->permissions = $role->abilities()->get()->all(); |
187 | - if (! count($role->permissions)) { |
|
187 | + if (!count($role->permissions)) { |
|
188 | 188 | unset($roles[$key]); |
189 | 189 | } |
190 | 190 | } |
@@ -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 | } |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -Route::middleware([config('azure-oath.routes.middleware')])->group(function () { |
|
3 | +Route::middleware([config('azure-oath.routes.middleware')])->group(function() { |
|
4 | 4 | Route::get(config('azure-oath.routes.login'), 'Metrogistics\AzureSocialite\WebAuthController@redirectToOauthProvider'); |
5 | 5 | Route::get(config('azure-oath.routes.callback'), 'Metrogistics\AzureSocialite\WebAuthController@handleOauthResponse'); |
6 | 6 | |
7 | 7 | // 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 |
8 | - if (! \Route::has('login')) { |
|
8 | + if (!\Route::has('login')) { |
|
9 | 9 | Route::get('login', 'Metrogistics\AzureSocialite\AuthController@loginOrRegister')->name('login'); |
10 | 10 | } |
11 | - if (! \Route::has('register')) { |
|
11 | + if (!\Route::has('register')) { |
|
12 | 12 | Route::get('register', 'Metrogistics\AzureSocialite\AuthController@loginOrRegister')->name('register'); |
13 | 13 | } |
14 | 14 | }); |