private function login(ServerRequestInterface $request, &$username)
{
//Check header
$authorization = self::parseAuthorizationHeader($request->getHeaderLine('Authorization'));
if (!$authorization) {
return false;
}
//Check whether user exists
if (!isset($this->users[$authorization['username']])) {
return false;
}
$username = $authorization['username'];
//Check authentication
return $this->checkAuthentication($authorization, $request->getMethod(), $this->users[$username]);
}