make an onBeginRequest event that points to some method
//action that will be executed before any other action
'onBeginRequest' => array('Bootstrap', 'beginRequest'),
// application components
'components'=>array(),
and the method will be something like this
class Bootstrap{
public function beginRequest(){
//check if the user is logged in
if(Yii::app()->user->isGuest){
//if not run the login controller and and end the application
Yii::app()->runController('login');
Yii::app()->end();
}
}
}