@@ -58,13 +58,13 @@ public function testConstructor()
58
58
59
59
60
60
/**
61
- * @param array $authHeaderContent
61
+ * @param string $authHeaderContent
62
62
* @dataProvider provideInvalidAuthenticationHeader
63
63
*/
64
- public function testIsAuthenticatedWithInvalidData (array $ authHeaderContent )
64
+ public function testIsAuthenticatedWithInvalidData (string $ authHeaderContent )
65
65
{
66
66
$ this ->request
67
- ->getHeader ('Authorization ' )
67
+ ->getHeaderLine ('Authorization ' )
68
68
->willReturn ($ authHeaderContent );
69
69
70
70
$ basicAccess = new BasicAccess (
@@ -78,13 +78,13 @@ public function testIsAuthenticatedWithInvalidData(array $authHeaderContent)
78
78
/**
79
79
* @param string $username
80
80
* @param string $password
81
- * @param array $header
81
+ * @param string $header
82
82
* @dataProvider provideValidAuthentication
83
83
*/
84
- public function testIsAuthenticatedWithValidCredential (string $ username , string $ password , array $ header )
84
+ public function testIsAuthenticatedWithValidCredential (string $ username , string $ password , string $ header )
85
85
{
86
86
$ this ->request
87
- ->getHeader ('Authorization ' )
87
+ ->getHeaderLine ('Authorization ' )
88
88
->willReturn ($ header );
89
89
$ this ->request
90
90
->withAttribute (UserInterface::class, Argument::type (UserInterface::class))
@@ -111,8 +111,8 @@ public function testIsAuthenticatedWithValidCredential(string $username, string
111
111
public function testIsAuthenticatedWithNoCredential ()
112
112
{
113
113
$ this ->request
114
- ->getHeader ('Authorization ' )
115
- ->willReturn ([ 'Basic QWxhZGRpbjpPcGVuU2VzYW1l ' ] );
114
+ ->getHeaderLine ('Authorization ' )
115
+ ->willReturn ('Basic QWxhZGRpbjpPcGVuU2VzYW1l ' );
116
116
117
117
$ this ->userRepository
118
118
->authenticate ('Aladdin ' , 'OpenSesame ' )
@@ -153,31 +153,31 @@ public function testGetUnauthenticatedResponse()
153
153
public function provideInvalidAuthenticationHeader (): array
154
154
{
155
155
return [
156
- 'empty-header ' => [[] ],
157
- 'missing-basic-prefix ' => [[ 'foo ' ] ],
158
- 'only-username ' => [[ 'Basic ' . base64_encode ('Aladdin ' )] ],
159
- 'username-with-colon ' => [[ 'Basic ' . base64_encode ('Aladdin: ' )] ],
160
- 'password-without-username ' => [[ 'Basic ' . base64_encode (':OpenSesame ' )] ],
161
- 'base64-encoded-pile-of-poo-emoji ' => [[ 'Basic ' . base64_encode ('💩 ' )] ],
162
- 'password-containing-colon ' => [[ 'Basic ' . base64_encode ('username:password:containing:colons: ' )] ],
163
- 'only-one-colon ' => [[ 'Basic ' . base64_encode (': ' )] ],
164
- 'multiple-colons ' => [[ 'Basic ' . base64_encode ('::::::: ' )] ],
165
- 'pile-of-poo-emoji ' => [[ 'Basic 💩 ' ] ],
166
- 'only-pile-of-poo-emoji ' => [[ '💩 ' ] ],
167
- 'basic-prefix-without-content ' => [[ 'Basic ' ] ],
168
- 'only-basic ' => [[ 'Basic ' ] ],
156
+ 'empty-header ' => ['' ],
157
+ 'missing-basic-prefix ' => ['foo ' ],
158
+ 'only-username ' => ['Basic ' . base64_encode ('Aladdin ' )],
159
+ 'username-with-colon ' => ['Basic ' . base64_encode ('Aladdin: ' )],
160
+ 'password-without-username ' => ['Basic ' . base64_encode (':OpenSesame ' )],
161
+ 'base64-encoded-pile-of-poo-emoji ' => ['Basic ' . base64_encode ('💩 ' )],
162
+ 'password-containing-colon ' => ['Basic ' . base64_encode ('username:password:containing:colons: ' )],
163
+ 'only-one-colon ' => ['Basic ' . base64_encode (': ' )],
164
+ 'multiple-colons ' => ['Basic ' . base64_encode ('::::::: ' )],
165
+ 'pile-of-poo-emoji ' => ['Basic 💩 ' ],
166
+ 'only-pile-of-poo-emoji ' => ['💩 ' ],
167
+ 'basic-prefix-without-content ' => ['Basic ' ],
168
+ 'only-basic ' => ['Basic ' ],
169
169
];
170
170
}
171
171
172
172
public function provideValidAuthentication (): array
173
173
{
174
174
return [
175
- 'aladdin ' => ['Aladdin ' , 'OpenSesame ' , [ 'Basic ' . base64_encode ('Aladdin:OpenSesame ' )] ],
176
- 'passwords-with-colon ' => ['Aladdin ' , 'Open:Sesame ' , [ 'Basic ' . base64_encode ('Aladdin:Open:Sesame ' )] ],
175
+ 'aladdin ' => ['Aladdin ' , 'OpenSesame ' , 'Basic ' . base64_encode ('Aladdin:OpenSesame ' )],
176
+ 'passwords-with-colon ' => ['Aladdin ' , 'Open:Sesame ' , 'Basic ' . base64_encode ('Aladdin:Open:Sesame ' )],
177
177
'passwords-with-multiple-colons ' => [
178
178
'Aladdin ' ,
179
179
':Open:Sesame: ' ,
180
- [ 'Basic ' . base64_encode ('Aladdin::Open:Sesame: ' )]
180
+ 'Basic ' . base64_encode ('Aladdin::Open:Sesame: ' )
181
181
],
182
182
];
183
183
}
0 commit comments