Does anyone have experience creating an authentication mechanism with the new router in pre4?
Here are some of my thoughts so far:
- In order to completely separate the view (Ember app) from the server (Rails app) I want to use token authentication. I will likely use Devise on the Rails server.
- I need something like a before_filter equivalent in the Ember app where I can check if there is a current user and if that user has an authentication token set.
- The Rails server will return the current auth token on every call. If it returns a null auth token the Ember app should detect this and transition to the unauthenticated state, redirecting to the login view.
I suspect I should be using an Ember state machine for this but I'm not sure how to proceed. Anyone tackled this problem yet?