Authentication 具有多个设计范围的Ember简单身份验证
我有以下情况:Authentication 具有多个设计范围的Ember简单身份验证,authentication,ember.js,devise,ember-simple-auth,Authentication,Ember.js,Devise,Ember Simple Auth,我有以下情况: 带有用户和管理员的Rails应用程序设计模型,所以我有两个范围 在路由器上的ember应用程序上创建: Router.map(function() { this.route('panel', function() { this.route('login'); this.route('logout'); }); this.route('admin', function() { this.route('login'); this.route
Router.map(function() {
this.route('panel', function() {
this.route('login');
this.route('logout');
});
this.route('admin', function() {
this.route('login');
this.route('logout');
});
});
/users/sign\u-in
和/admins/sign\u-in
我遵循了上的步骤,身份验证正在工作
Ember在创建了验证器和适配器之后找到了正确的URL,但问题是ESA只有一个会话服务。一旦用户或管理员登录了会话。isAuthenticated
为真,我不知道登录了哪些作用域
以下哪种方式是最好的继续:
角色
,并在会话中设置我解决了这个问题,为每个范围创建了3个,我处理每个范围 在我不使用其他身份验证程序(OAuth2)时,这是一个特殊的解决方案,但现在我可以检查登录时是否使用了
authenticator:user
,authenticator:admin
,authenticator:manager
我已经创建了路由检查,所以用户只能访问他的面板,管理员可以访问用户和管理员面板,经理可以访问整个系统
我已经在github上发布了ember和API:
- 余烬
- 用于设计api
ps:我认为最好为每个作用域创建会话,但我不知道如何做(如果更好或不更好),在这个解决方案中,您可以一次登录一个作用域(不像Desive on rails,您可以一次登录多个作用域)。那些github repo不再存在。