Using kohana way it could be simple. In you main controller that you are extending, or using, use before function where you will determine if user is logged in and take some action if yes or not.
Just use kohana Auth module to logg in user, for ex:
Auth::instance()->login($username, $password);
Then kohana will automatically save that user as logged in.
You before function should contain something like:
if (!Auth::instance()->logged_in())
{
//redirect to login page
}
This way you will check if user is logged in when he will try to open other page.
If you are using also ajax, that should be also applied to main ajax controller in same way.
Then to log out user use:
Auth::instance()->logout();