How to overide or promote default routes in cake 3.x

I’m in the process of migrating a site from 2.x to 3.7 and need to change the default route for “/” depending upon whether the user is logged in or not. I don’t seem to be able to access the Auth component while in the routes.php and so struggling to still provide this functionality.

In 2.x I could use the promote method or do something like this in the boostrap.php

App::uses(‘CakeSession’, ‘Model/Datasource’);
$Session = new CakeSession();
if ($Session->read(‘Auth.User’)) {
    Configure::write(‘Route.default’, array(‘controller’ => ‘users’, ‘action’ => ‘myProfile’));
}else {
    Configure::write(‘Route.default’, array(‘controller’ => ‘pages’, ‘action’ => ‘home’, ‘home’));

}

Is there a way in 3.x to define multiple routes in the routes.php and select which is the active route from within a controller?

The route i want to change currently looks like this:

Router::scope(’/’, function (RouteBuilder $routes) {
    $routes->connect(’/’, [‘controller’ => ‘Users’, ‘action’ => ‘profile’, ‘profile’]);
    $routes->fallbacks(DashedRoute::class);
});

Be nice to be able to pass a flag through via the Router::reload() method !