File tree 2 files changed +19
-0
lines changed
src/Symfony/Component/HttpFoundation
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,10 @@ public function getHeaders()
86
86
}
87
87
}
88
88
89
+ if (isset ($ headers ['AUTHORIZATION ' ])) {
90
+ return $ headers ;
91
+ }
92
+
89
93
// PHP_AUTH_USER/PHP_AUTH_PW
90
94
if (isset ($ headers ['PHP_AUTH_USER ' ])) {
91
95
$ headers ['AUTHORIZATION ' ] = 'Basic ' .base64_encode ($ headers ['PHP_AUTH_USER ' ].': ' .$ headers ['PHP_AUTH_PW ' ]);
Original file line number Diff line number Diff line change @@ -151,4 +151,19 @@ public function testOAuthBearerAuthWithRedirect()
151
151
'AUTHORIZATION ' => $ headerContent ,
152
152
), $ bag ->getHeaders ());
153
153
}
154
+
155
+ /**
156
+ * @see https://github.com/symfony/symfony/issues/17345
157
+ */
158
+ public function testItDoesNotOverwriteTheAuthorizationHeaderIfItIsAlreadySet ()
159
+ {
160
+ $ headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo ' ;
161
+ $ bag = new ServerBag (array ('PHP_AUTH_USER ' => 'foo ' , 'HTTP_AUTHORIZATION ' => $ headerContent ));
162
+
163
+ $ this ->assertEquals (array (
164
+ 'AUTHORIZATION ' => $ headerContent ,
165
+ 'PHP_AUTH_USER ' => 'foo ' ,
166
+ 'PHP_AUTH_PW ' => '' ,
167
+ ), $ bag ->getHeaders ());
168
+ }
154
169
}
You can’t perform that action at this time.
0 commit comments