1 | <?php |
||
19 | class AuthenticatorTest extends \PHPUnit_Framework_TestCase |
||
20 | { |
||
21 | // @codingStandardsIgnoreStart |
||
22 | |||
23 | /** |
||
24 | * Created using jwt.io |
||
25 | */ |
||
26 | const TEST_TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImtleU9uZSJ9.eyJwcm4iOiJqb2huIiwiaXNzIjoiaHR0cDovL2FwaS5zZXJ2ZXIxLmNvbS9vYXV0aDIvdG9rZW4ifQ._jXjAWMzwwG1v5N3ZOEUoLGSINtmwLsvQdfYkYAcWiY'; |
||
27 | |||
28 | const JKEY_CLASS = 'KleijnWeb\JwtBundle\Authenticator\JwtKey'; |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | private static $keyConfig = [ |
||
34 | 'keyOne' => |
||
35 | [ |
||
36 | 'issuer' => 'http://api.server1.com/oauth2/token', |
||
37 | 'secret' => 'A Pre-Shared Key', |
||
38 | 'type' => 'HS256', |
||
39 | ], |
||
40 | 'keyTwo' => |
||
41 | [ |
||
42 | 'issuer' => 'http://api.server2.com/oauth2/token', |
||
43 | 'type' => 'RS256', |
||
44 | 'secret' => 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0F', |
||
45 | ], |
||
46 | ]; |
||
47 | |||
48 | // @codingStandardsIgnoreEnd |
||
49 | |||
50 | /** |
||
51 | * @var JwtKey[] |
||
52 | */ |
||
53 | private $keys; |
||
54 | |||
55 | protected function setUp() |
||
63 | |||
64 | /** |
||
65 | * @test |
||
66 | */ |
||
67 | public function getGetKeysUsingIndexesInConfig() |
||
74 | |||
75 | /** |
||
76 | * @test |
||
77 | */ |
||
78 | public function willGetSingleKeyWhenKeyIdIsNull() |
||
87 | |||
88 | /** |
||
89 | * @test |
||
90 | * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException |
||
91 | */ |
||
92 | public function willFailWhenTryingToGetKeyWithoutIdWhenThereAreMoreThanOne() |
||
98 | |||
99 | /** |
||
100 | * @test |
||
101 | * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException |
||
102 | */ |
||
103 | public function willFailWhenTryingToGetUnknownKey() |
||
109 | |||
110 | /** |
||
111 | * @test |
||
112 | * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException |
||
113 | */ |
||
114 | public function willFailWhenTryingToGetUserNameFromClaimsWithoutPrn() |
||
120 | |||
121 | /** |
||
122 | * @test |
||
123 | */ |
||
124 | public function canGetUserNameFromClaims() |
||
130 | |||
131 | /** |
||
132 | * @test |
||
133 | */ |
||
134 | public function authenticateTokenWillSetUserFetchedFromUserProviderOnToken() |
||
149 | |||
150 | /** |
||
151 | * @test |
||
152 | */ |
||
153 | public function supportsPreAuthToken() |
||
161 | |||
162 | /** |
||
163 | * @test |
||
164 | * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException |
||
165 | */ |
||
166 | public function willFailWhenApiKeyNotFoundInHeader() |
||
172 | |||
173 | /** |
||
174 | * @test |
||
175 | */ |
||
176 | public function canGetAnonTokenWithClaims() |
||
186 | } |
||
187 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..