src/Http/Response.php
function basicAuth(array $users, $options = array())
    {
        $user = &$_SERVER['PHP_AUTH_USER'];
        $password = &$_SERVER['PHP_AUTH_PW'];
        if (isset($users[$user]) && (0 === strcmp($password, $users[$user]))) {
            $_SERVER['CP_AUTH_USER'] = $user;
            return;
        }

        $realm = &$options['realm'];
        if (null === $realm) {
            $realm = 'CP Login Required';
        }

        $message = &$options['fail_msg'];
        if (null === $message) {
            $message = self::$statusDescriptions[401];
        }

        $this->setResponseStatus(401)
            ->setHeader('WWW-Authenticate: Basic realm="' . $realm . '"')
            ->displayOver($message);
    }
function basicAuth(array $users, $options = array())
    {
        $user = &$_SERVER['PHP_AUTH_USER'];
        $password = &$_SERVER['PHP_AUTH_PW'];
        if (isset($users[$user]) && (0 === strcmp($password, $users[$user]))) {
            $_SERVER['CP_AUTH_USER'] = $user;
            return;
        }

        $realm = &$options['realm'];
        if (null === $realm) {
            $realm = 'CP Login Required';
        }

        $message = &$options['fail_msg'];
        if (null === $message) {
            $message = self::$statusDescriptions[401];
        }

        $this->setResponseStatus(401)
            ->setHeader('WWW-Authenticate: Basic realm="' . $realm . '"')
            ->displayOver($message);
    }
basic authentication

@param array $users ['user' => 'password']
@param array $options