From 87fe9d9e649bc6bd871a010d303b5f42bcf8a848 Mon Sep 17 00:00:00 2001 From: lippoliv Date: Sun, 18 Oct 2015 22:18:37 +0200 Subject: [PATCH 1/2] Update basic-auth.php Closes #25 --- basic-auth.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/basic-auth.php b/basic-auth.php index 805918c..47d1c59 100644 --- a/basic-auth.php +++ b/basic-auth.php @@ -17,6 +17,11 @@ function json_basic_auth_handler( $user ) { if ( ! empty( $user ) ) { return $user; } + + // Support PHP FastCGI Redirect + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { + list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6))); + } // Check that we're trying to authenticate if ( !isset( $_SERVER['PHP_AUTH_USER'] ) ) { From 88d4905f4b31213e0fa24e314cf35152a68c0304 Mon Sep 17 00:00:00 2001 From: lippoliv Date: Sat, 24 Oct 2015 11:16:22 +0200 Subject: [PATCH 2/2] Authentication-fix Fixing up Problem throuth my changes in #25, so Plugin thought each request is with autentication. --- basic-auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basic-auth.php b/basic-auth.php index 47d1c59..42b966a 100644 --- a/basic-auth.php +++ b/basic-auth.php @@ -24,7 +24,7 @@ function json_basic_auth_handler( $user ) { } // Check that we're trying to authenticate - if ( !isset( $_SERVER['PHP_AUTH_USER'] ) ) { + if ( !isset( $_SERVER['PHP_AUTH_USER'] ) || $_SERVER['PHP_AUTH_USER'] === '' ) { return $user; }