Merge branch 'master' into 'master'

Basic Auth Bugfix

Bugfix on Basic Auth username/password split.

Basic Auth uses a colon (":") to separate the username and password values. Using the php 'explode' function on this string without limiting the number of substrings returned can truncate the users password if it contains a colon.

By limiting the explode to 2, we get back the username and whatever else is left as the password (hence not truncated).

See merge request !12
This commit is contained in:
Andrew Ruthven 2015-05-18 23:07:52 +00:00
commit 71db9008af

View File

@ -106,7 +106,7 @@ class HTTPAuthSession {
if (isset($_SERVER['AUTHORIZATION']) && !empty($_SERVER['AUTHORIZATION'])) {
list ($type, $cred) = explode(" ", $_SERVER['AUTHORIZATION']);
if ($type == 'Basic') {
list ($user, $pass) = explode(":", base64_decode($cred));
list ($user, $pass) = explode(":", base64_decode($cred), 2);
$_SERVER['PHP_AUTH_USER'] = $user;
$_SERVER['PHP_AUTH_PW'] = $pass;
}