Ember 简单的 Auth 子域重定向

Ember Simple Auth subdomain redirects

我已经能够使用基于共享 Ember Simple Auth cookie 的身份验证成功设置多个 Ember 应用程序。我旅程的下一步是在应用程序之间设置正确的重定向。听我说完。

场景 A(开箱即用,耶!)

场景 B(开箱即用,耶!)

场景C(这是我需要实现的)

任何帮助或指导将不胜感激。我想知道我是否可以仅使用 Ember 简单身份验证实现 场景 C,或者我是否需要在子域等 beforeModel 中编写自定义重定向逻辑等

您可以通过覆盖 AuthenticatedRouteMixin's beforeModel method. That will by default to an (Ember.js) transition to the login route but in your case you want sth. like window.location.replace('domain.com/login') and remember the current URL in a cookie or so. In order to redirect to app-a.domain.com/deep/link/resource after the user logged in you'll need to override the ApplicationRouteMixin's sessionAuthenticated method 来使方案 C 工作,以便它重定向到 cookie 中记住的前一个 URL(如果存在),如果不存在则回退到默认行为.

总体而言,按照这些步骤实际操作应该非常简单。