使用ember.js当处理用户身份验证 [英] Handling user authentication when using ember.js

查看:219
本文介绍了使用ember.js当处理用户身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找了对ember.js文档和岗位,并使用ember.js使用Rails。

I was looking up documentation and posts on ember.js, and using ember.js with Rails.

我喜欢Rails的提供API和ember.js处理用户界面,但我不知道如何堵塞用户身份验证的想法。

I like the idea of Rails providing the API, and ember.js handling the UI, but I was wondering how to plug User authentication.

例如,说我使用的设计,我怎么使用它ember.js?

Eg, say I am using devise, how do I use it with ember.js?

任何指针将是非常美联社preciated。

Any pointers would be much appreciated.

推荐答案

更新2

查看使用混合轨查看+设计变量这一新的GitHub的示例应用程序运行-scoped烬应用上烬1.0.rc.1 +烬数据转速11和仍然存在的has_many关系。

Check out this new github example app that uses a hybrid rails view + devise-variable-scoped ember app that runs on ember 1.0.rc.1 + ember-data rev 11 and persists has_many relationships.

查看此令牌认证项目那是没有完全准备好,但显示了很多的承诺。这可能是非常适合用于验证用户的客户端,而不是简单的基于Web的轨道查看制订权威性移动客户端的API。

Check out this token authentication project that isn't quite ready but shows a lot of promise. This could be great for mobile client apis that authenticate users client-side, as opposed to simple web-based rails view devise auth.

两者都提供了有趣和值得商榷的用例。我期待着在这里这正好在未来。

Both provide for interesting and debatable use cases. I look forward to seeing where this goes in the future.

更新1

我添加使用设计到Dgeb的余烬数据的例子在这里应用超级基本用户身份验证:<一href=\"https://github.com/dgeb/ember_data_example/pull/17\">https://github.com/dgeb/ember_data_example/pull/17 。我用Rails的控制器,用于身份验证的创建和范围,增加CURRENT_USER USER_ID对创建新的联系人记录,而通过摄食范围current_user.id AMS数据余烬应用。

I added super basic user auth using Devise to Dgeb's ember-data example app here: https://github.com/dgeb/ember_data_example/pull/17 . I used Rails controllers for auth creation and scoping, adding current_user user_id's to the creation of new Contact records, while feeding scoped AMS data to the ember app through current_user.id.

我已经有一段时间,唯一的开源烬例如应用程序,我已经能够找到一个具有用户身份验证,使用滑轨这同一个问题的https://github.com/carvil/dash-it 。他用,一旦用户登录沿着CURRENT_USER信息传递给一个ember.js一个应用Rails的设计login视图。

I've had this very same question for a while and the only open-source ember example app I've been able to find that has user authentication and uses rails is https://github.com/carvil/dash-it. He uses a Rails-Devise login view that passes along current_user info to an ember.js app once the user is logged in.

我知道很多其他人使用设计token_authenticatable完全删除Rails的意见,并在灰烬通过令牌严格应用程式用户进行身份验证。这可能是最好的一段路要走,但我没有试过在一个应用程序还没有实现它自己,我还没有发现,走这条路的任何开源的应用程序。

I know many other people use Devise token_authenticatable to completely remove Rails views and authenticate users in Ember apps strictly through tokens. This is probably the best way to go, but I haven't tried implementing it in an app myself yet, and I haven't found any open source apps that go this route.

汤姆戴尔的灰烬的领先开发商之一,说他们没有最惠国的地位还没有对任何特定用户的身份验证解决方案,所以,直到他们要么正式支持一个具体的解决方案或建立一进框架,我假设制定令牌,以最好的一段路要走。

Tom Dale, one of the lead developers of Ember, says that they don't have a "favored nation" status yet for any specific user auth solution, so until they either officially support a specific solution or build one into the framework, I'm assuming Devise tokens are the best way to go.

希望有人有更多的灰烬/用户身份验证的经验比我可以附和并展示超过 HTTPS更好的解决方案:// github上。 COM / carvil / DASH-它,采用Ember的状态机和路由与基于令牌的用户验证组合。

Hopefully someone that has more Ember/user auth experience than me can chime in and demonstrate a better solution than https://github.com/carvil/dash-it, using Ember's state machine and routing in combination with token-based user auth.

这篇关于使用ember.js当处理用户身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆