ruby-on-rails - 在生产应用程序中从头开始进行身份验证?

标签 ruby-on-rails ruby ruby-on-rails-3 authentication devise

使用 Authentication from scratch system 是个好主意吗?来自生产应用程序中 Hart 的 Ruby on Rail 教程?使用它有安全问题吗?已经在使用它的应用是否应该迁移到 Devise?如何做到这一点?

最佳答案

在我看来,使用像 devise 这样的 gem 是比从头编写身份验证更好的解决方案,因为您甚至可能不知道此类 gem 可以为我们处理的一些安全问题,因为它们由整个社区而不是一个人开发。

此外,当我已经有了一个很棒的解决方案时,我真的不想重新发明轮子。我在许多生产应用程序中使用过 devise,它比普通身份验证做得更多,这就是它的闪光点:)

但是,如果您正在通过 ruby​​ on rails 学习自己的方法,我真的建议您从头开始编写身份验证,但即便如此,最初也不要用于生产应用程序。

正如 devise's documentation 中所说:

If you are building your first Rails application, we recommend you to not use Devise. Devise requires a good understanding of the Rails Framework. In such cases, we advise you to start a simple authentication system from scratch, today we have two resources:

Michael Hartl's online book: http://railstutorial.org/chapters/modeling-and-viewing-users-two#top Ryan Bates' Railscast: http://railscasts.com/episodes/250-authentication-from-scratch

Once you have solidified your understanding of Rails and authentication mechanisms, we assure you Devise will be very pleasant to work with. :)

关于ruby-on-rails - 在生产应用程序中从头开始进行身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20695495/

相关文章:

ruby-on-rails - Rails 3 - 使用 I18n 翻译路线

php - 关于将 PHP 应用程序转换为 ROR 以与 Heroku 一起使用的想法?

ruby-on-rails - 如何在生产环境中启动乘客?

ruby-on-rails-3 - 在浏览器中加载页面时,Rails 3.2.11 JavaScript Assets 陷入循环

ruby-on-rails - rails : Form_for fields without corresponding database columns

ruby-on-rails - 如何在 Rails 中制作 UI 组件?

ruby-on-rails - 上帝搞乱了日期操作

ruby-on-rails - 无法修改关联 'User#roles',因为源反射类 'Role' 通过 :has_many 关联到 'Profile'

ruby-on-rails - rails 引脚 : How does the pin id work?

javascript - Ajax.Request 的 onComplete 带有缓存内容的 bug