1

Ember Simple Auth provides a route mixin that lets you authenticate certain routes in your application.

I'm working an app where essentially every route (except the login route) is authenticated. Is is possible to specify this in a single option somewhere, instead of having to include the mixin in each route?

Sam Selikoff
  • 12,366
  • 13
  • 58
  • 104

1 Answers1

1

No, that's not possible. The best solution is to add an internal route and move all routes (except the login and index routes) under that route. From the index route's beforeModel you could transition to the internal route when the session is already authenticated.

marcoow
  • 4,062
  • 1
  • 14
  • 21
  • I recommend this approach as well. Having one authenticated parent route let's you load in your user's profile, account info, and any other user specific information in one place. Your other children routes can use use this information right away in their beforeModel hooks, since it's been already been resolved by parent route (for example, an admin route can bounce out non-admin users) – Stephen Prockow Jul 29 '15 at 19:35