Passed
Push — master ( ae195e...1cc4f4 )
by meta
02:53
created
src/ServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,26 +16,26 @@  discard block
 block discarded – undo
16 16
         // Make sure nobody is including or running this thing without all the required env settings
17 17
         $requiredVariables = ['AZURE_AD_CLIENT_ID', 'AZURE_AD_CLIENT_SECRET', 'AZURE_AD_TENANT', 'AZURE_AD_CALLBACK_URL'];
18 18
         foreach ($requiredVariables as $env) {
19
-            if (! env($env)) {
19
+            if (!env($env)) {
20 20
                 throw new \Exception('enterpriseauth setup error: missing mandatory .env value for '.$env);
21 21
             }
22 22
         }
23 23
 
24 24
         // Actually I have my own oauth token cache based authentication guard now lol
25 25
         config(['auth.guards.api.driver' => 'oauthtoken']);
26
-        Auth::extend('oauthtoken', function ($app, $name, array $config) {
26
+        Auth::extend('oauthtoken', function($app, $name, array $config) {
27 27
             return new \Metaclassing\EnterpriseAuth\Middleware\OauthTokenGuard(Auth::createUserProvider($config['provider']), $app->make('request'));
28 28
         });
29 29
 
30 30
         // Make sure that this vendor dir and the routes dir are in any scanned paths for swagger documentation
31 31
         $swaggerScanPaths = config('l5-swagger.paths.annotations');
32
-        if (! is_array($swaggerScanPaths)) {
32
+        if (!is_array($swaggerScanPaths)) {
33 33
             $swaggerScanPaths = [$swaggerScanPaths];
34 34
         }
35
-        if (! in_array(base_path('routes'), $swaggerScanPaths)) {
35
+        if (!in_array(base_path('routes'), $swaggerScanPaths)) {
36 36
             $swaggerScanPaths[] = base_path('routes');
37 37
         }
38
-        if (! in_array(__DIR__.'/../routes/', $swaggerScanPaths)) {
38
+        if (!in_array(__DIR__.'/../routes/', $swaggerScanPaths)) {
39 39
             $swaggerScanPaths[] = __DIR__.'/../routes/';
40 40
         }
41 41
         config(['l5-swagger.paths.annotations' => $swaggerScanPaths]);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         // If the routes files for the swagger oauth config is NOT present, and we have all the right info, then generate it really quick
67 67
         $swaggerAzureadFile = __DIR__.'/../routes/swagger.azuread.php';
68
-        if (! file_exists($swaggerAzureadFile)) {
68
+        if (!file_exists($swaggerAzureadFile)) {
69 69
             $aad = new AzureActiveDirectory(env('AZURE_AD_TENANT'));
70 70
             //$authorizationUrl = $aad->authorizationEndpoint . '?resource=https://graph.microsoft.com';
71 71
             $authorizationUrl = $aad->authorizationEndpoint;
Please login to merge, or discard this patch.
src/Controllers/AuthController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     public function scrubMicrosoftGraphUserData($userData)
49 49
     {
50 50
         // Fix any stupid crap with missing or null fields
51
-        if (! isset($userData['mail']) || ! $userData['mail']) {
51
+        if (!isset($userData['mail']) || !$userData['mail']) {
52 52
             $userData['mail'] = $userData['userPrincipalName'];
53 53
         }
54 54
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         // Try to find an existing user
64 64
         $user = $userType::where($userIdField, $userData['id'])->first();
65 65
         // If we dont have an existing user
66
-        if (! $user) {
66
+        if (!$user) {
67 67
             // Go create a new one with this data
68 68
             $user = $this->createUserFromAzureData($userData);
69 69
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     public function certAuth()
96 96
     {
97 97
         // Make sure we got a client certificate from the web server
98
-        if (! $_SERVER['SSL_CLIENT_CERT']) {
98
+        if (!$_SERVER['SSL_CLIENT_CERT']) {
99 99
             throw new \Exception('TLS client certificate missing');
100 100
         }
101 101
         // try to parse the certificate we got
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $asciicert = str_replace("\t", '', $_SERVER['SSL_CLIENT_CERT']);
105 105
         $cert = $x509->loadX509($asciicert);
106 106
         $names = $x509->getExtension('id-ce-subjectAltName');
107
-        if (! $names) {
107
+        if (!$names) {
108 108
             throw new \Exception('TLS client cert missing subject alternative names');
109 109
         }
110 110
         // Search subject alt names for user principal name
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
                 }
119 119
             }
120 120
         }
121
-        if (! $upn) {
121
+        if (!$upn) {
122 122
             throw new \Exception('Could not find user principal name in TLS client cert');
123 123
         }
124 124
         $user_class = config('enterpriseauth.user_class');
125 125
         $user = $user_class::where('userPrincipalName', $upn)->first();
126
-        if (! $user) {
126
+        if (!$user) {
127 127
             throw new \Exception('No user found with user principal name '.$upn);
128 128
         }
129 129
         //dd($user);
Please login to merge, or discard this patch.