Completed
Pull Request — master (#15)
by Oguzhan
02:20
created
src/Authenticator/Authenticator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         $user = $userProvider->loadUserByUsername($jwtToken->getSubject());
104 104
 
105
-        if($user instanceof UserInterface) {
105
+        if ($user instanceof UserInterface) {
106 106
             $user = $this->setUserRolesFromAudienceClaims($user, $token);
107 107
         }
108 108
 
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
         /** @var JwtToken $credentials */
132 132
         $credentials = $token->getCredentials();
133 133
 
134
-        foreach($credentials->getClaims() as $claimKey => $claimValue)
134
+        foreach ($credentials->getClaims() as $claimKey => $claimValue)
135 135
         {
136
-            if($claimKey === 'aud') {
137
-                if(is_array($claimValue)) {
138
-                    foreach($claimValue as $role) {
136
+            if ($claimKey === 'aud') {
137
+                if (is_array($claimValue)) {
138
+                    foreach ($claimValue as $role) {
139 139
                         $user->addRole($role);
140 140
                     }
141
-                } elseif(is_string($claimValue)) {
141
+                } elseif (is_string($claimValue)) {
142 142
                     $user->addRole($claimValue);
143 143
                 }
144 144
             }
Please login to merge, or discard this patch.
src/Tests/Authenticator/AuthenticatorTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     {
176 176
         $authenticator = new Authenticator($this->keys);
177 177
         $request       = new Request();
178
-        $request->headers->set('Authorization', 'Bearer ' . self::TEST_TOKEN);
178
+        $request->headers->set('Authorization', 'Bearer '.self::TEST_TOKEN);
179 179
         $token = $authenticator->createToken($request, 'myprovider');
180 180
 
181 181
         $expected = new JwtToken(self::TEST_TOKEN);
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      */
220 220
     public function willAddMultipleRolesFromAudienceClaimsInToken()
221 221
     {$authenticator = new Authenticator($this->keys);
222
-        $token         = $this->createToken(['sub' => 'john', 'aud' => ['guests', 'users' ]]);
222
+        $token         = $this->createToken(['sub' => 'john', 'aud' => ['guests', 'users']]);
223 223
         $anonToken     = new PreAuthenticatedToken('foo', $token, 'myprovider');
224 224
 
225 225
         $user          = $this->getMockBuilder(
Please login to merge, or discard this patch.