After some Googling, I found a method Router.generate()that takes the name of the router (and optional parameters) and returns the URL. Now I updated my authorization step as follows:
@inject(Router, AuthService)
class AuthorizeStep {
constructor (router, authService) {
this.router = router;
this.authService = authService;
}
run (navigationInstruction, next) {
if (navigationInstruction.getAllInstructions().some(i => i.config.auth)) {
if (!this.authService.isLoggedIn) {
return next.cancel(new Redirect(this.router.generate('login')));
}
}
return next();
}
}
Edit: after a few more searches, I found a class RedirectToRoute;
import { RedirectToRoute } from 'aurelia-router';
...
return next.cancel(new RedirectToRoute('login'));