public function onAfterRoute()
    {
        $app = JFactory::getApplication();

        $username = $app->input->server->get('PHP_AUTH_USER', null, 'string');
        $password = $app->input->server->get('PHP_AUTH_PW', null, 'string');

        if ($username && $password)
        {
            if (!$this->_login($username, $password, $app)) {
                throw new Exception('Login failed', 401);
            }
        }
    }
public function onAfterRoute()
    {
        $app = JFactory::getApplication();

        $username = $app->input->server->get('PHP_AUTH_USER', null, 'string');
        $password = $app->input->server->get('PHP_AUTH_PW', null, 'string');

        if ($username && $password)
        {
            if (!$this->_login($username, $password, $app)) {
                throw new Exception('Login failed', 401);
            }
        }
    }
public function onAfterRoute ( ) { $ app = JFactory :: getApplication ( ) ; $ username = $ app -> input -> server -> get ( 'PHP_AUTH_USER' , null , 'string' ) ; $ password = $ app -> input -> server -> get ( 'PHP_AUTH_PW' , null , 'string' ) ; if ( $ username && $ password ) { if ( ! $ this -> _login ( $ username , $ password , $ app ) ) { throw new Exception ( 'Login failed' , 401 ) ; } } }
Ask for authentication and log the user in into the application.

@return  void
Ask for authentication and log the user in into the application .