-
-
Notifications
You must be signed in to change notification settings - Fork 51
Basic Auth
Gary Jones edited this page May 31, 2016
·
1 revision
Certain server arrangements don't allow the Basic Auth credentials to be made available under PHP. To get around this, you'll need to set an environment variable in the site root .htaccess
file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
This must be in the site root .htaccess
(not the wp-content/uploads/satispress/.htaccess
), and it must come before the WordPress redirects.
Until the following has been added into a released version of SatisPress, you'll also need to amend authorize_package_request()
method inside class/satispress-authentication-basic.php
. Add the following as the first line of that method, before the $user
variable is set:
if ( ! isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['HTTP_AUTHORIZATION'] ) ) {
list( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ) =
explode( ':', base64_decode( substr( $_SERVER['HTTP_AUTHORIZATION'], 6 ) ) );
}