@@ -20,7 +20,7 @@ |
||
| 20 | 20 | class TestBundle extends Bundle |
| 21 | 21 | { |
| 22 | 22 | /** |
| 23 | - * @return ExtensionInterface |
|
| 23 | + * @return boolean |
|
| 24 | 24 | */ |
| 25 | 25 | public function getContainerExtension() |
| 26 | 26 | { |
@@ -25,6 +25,6 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | public function registerContainerConfiguration(LoaderInterface $loader) |
| 27 | 27 | { |
| 28 | - $loader->load(__DIR__ . '/config.yml'); |
|
| 28 | + $loader->load(__DIR__.'/config.yml'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
@@ -151,7 +151,7 @@ |
||
| 151 | 151 | if ($this->requiredClaims) { |
| 152 | 152 | $missing = array_diff_key(array_flip($this->requiredClaims), $claims); |
| 153 | 153 | if (count($missing)) { |
| 154 | - throw new \InvalidArgumentException("Missing claims: " . implode(', ', $missing)); |
|
| 154 | + throw new \InvalidArgumentException("Missing claims: ".implode(', ', $missing)); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | if ($this->issuer && !isset($claims['iss'])) { |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | |
| 11 | 11 | use KleijnWeb\JwtBundle\Tests\Authenticator\AuthenticatorTest; |
| 12 | 12 | use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
| 13 | -use Symfony\Bundle\FrameworkBundle\Client; |
|
| 14 | 13 | |
| 15 | 14 | /** |
| 16 | 15 | * @author John Kleijn <[email protected]> |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | $client = $this->createClient(); |
| 97 | 97 | $server = []; |
| 98 | 98 | if ($token) { |
| 99 | - $server = ['HTTP_AUTHORIZATION' => 'Bearer ' . $token]; |
|
| 99 | + $server = ['HTTP_AUTHORIZATION' => 'Bearer '.$token]; |
|
| 100 | 100 | } |
| 101 | 101 | $client->request('GET', $url, $parameters = [], $files = [], $server); |
| 102 | 102 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function load(array $configs, ContainerBuilder $container) |
| 27 | 27 | { |
| 28 | 28 | $config = $this->processConfiguration(new Configuration(), $configs); |
| 29 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 29 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 30 | 30 | $loader->load('services.yml'); |
| 31 | 31 | |
| 32 | 32 | $keys = []; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | foreach ($config['keys'] as $keyId => $keyConfig) { |
| 35 | 35 | |
| 36 | 36 | $keyConfig['kid'] = $keyId; |
| 37 | - $keyDefinition = new Definition('jwt.keys.' . $keyId); |
|
| 37 | + $keyDefinition = new Definition('jwt.keys.'.$keyId); |
|
| 38 | 38 | $keyDefinition->setClass('KleijnWeb\JwtBundle\Authenticator\JwtKey'); |
| 39 | 39 | |
| 40 | 40 | if (isset($keyConfig['loader'])) { |
@@ -102,7 +102,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 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); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | UserInterface::class |
| 213 | 213 | )->getMockForAbstractClass(); |
| 214 | 214 | |
| 215 | - $token = new PreAuthenticatedToken($user, $token, 'providerkey'); |
|
| 215 | + $token = new PreAuthenticatedToken($user, $token, 'providerkey'); |
|
| 216 | 216 | |
| 217 | 217 | $user->expects($this->exactly(2)) |
| 218 | 218 | ->method('addRole'); |