We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 48bb282 commit 9a5da9cCopy full SHA for 9a5da9c
examples/src/Auth.php
@@ -97,8 +97,10 @@ private function getPrincipalNameFromCertificate(X509 $userCertificate): string
97
*/
98
public function validate()
99
{
100
- $headers = getallheaders();
101
- if (!isset($headers["X-CSRF-TOKEN"]) || ($headers["X-CSRF-TOKEN"] != $_SESSION["csrf-token"])) {
+ // Header names must be treated as case-insensitive (according to RFC2616) so we convert them to lowercase
+ $headers = array_change_key_case(getallheaders(), CASE_LOWER);
102
+
103
+ if (!isset($headers["x-csrf-token"]) || ($headers["x-csrf-token"] != $_SESSION["csrf-token"])) {
104
header("HTTP/1.0 405 Method Not Allowed");
105
echo "CSRF token missing, unable to process your request";
106
return;
0 commit comments