This repository was archived by the owner on Jan 29, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,15 @@ public function __construct(
5252
5353 public function authenticate (ServerRequestInterface $ request ) : ?UserInterface
5454 {
55- $ authHeader = $ request ->getHeader ('Authorization ' );
56- if (! isset ($ authHeader [0 ])) {
55+ $ authHeaders = $ request ->getHeader ('Authorization ' );
56+
57+ if (1 !== count ($ authHeaders )) {
5758 return null ;
5859 }
5960
60- if (! preg_match ('/Basic (?P<credentials>.+)/ ' , $ authHeader [0 ], $ match )) {
61+ $ authHeader = array_shift ($ authHeaders );
62+
63+ if (! preg_match ('/Basic (?P<credentials>.+)/ ' , $ authHeader , $ match )) {
6164 return null ;
6265 }
6366
Original file line number Diff line number Diff line change @@ -166,6 +166,12 @@ public function provideInvalidAuthenticationHeader(): array
166166 'only-pile-of-poo-emoji ' => [['💩 ' ]],
167167 'basic-prefix-without-content ' => [['Basic ' ]],
168168 'only-basic ' => [['Basic ' ]],
169+ 'multiple-auth-headers ' => [
170+ [
171+ ['Basic ' . base64_encode ('Aladdin:OpenSesame ' )],
172+ ['Basic ' . base64_encode ('Aladdin:OpenSesame ' )],
173+ ],
174+ ],
169175 ];
170176 }
171177
You can’t perform that action at this time.
0 commit comments