In Durandal 2.0, this is achieved using router.guardRoute:
auth = require('auth');
router.guardRoute = function(model, route) {
return auth.loggedIn() || '#/login';
};
From what I've read, though undocumented the behavior works the same in Durandal 1.x. Guard route is a function called after the viewModel is loaded but before activate is called on the view model. If true, routing proceeds. If a string, the router tries to navigate to the route associated with that string.